Best approach for getting component field values from currentStyle or properties object | Community
Skip to main content
New Participant
October 16, 2015
Solved

Best approach for getting component field values from currentStyle or properties object

  • October 16, 2015
  • 1 reply
  • 528 views

Hi,

 
I have a component with design_dialogue. So in component JSP i access the field values of component via "currentStyle." object and it works great.
 
For example:
currentStyle.heading
currentStyle.imagePath
 
Now I have a requirement that i need the complete <div> of component exposed as JSON for which I am using <c:import>.
But one thing I noticed that when I access the /etc/design node directly using ".html" at end then all the field values are stored in "properties" implict 
 
<c:import var="compDiv1" url="/etc/designs/global/en_US/jcr:content/mySite1/myComp1.html"/>
<c:import var="compDiv2" url="/etc/designs/global/en_US/jcr:content/mySite1/myComp2.html"/>
<c:import var="compDiv3" url="/etc/designs/global/en_US/jcr:content/mySite1/myComp3.html"/>
 
So in JSP i might need to write duplicate code of checking if the variable (or field) value is NOT BLANK in "currentStyle" object then take values from "currentStyle" or object otherwise take from "properties" object.
 
Is there any better way to handle this situation ?
 
Thanks in advance.
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by smacdonald2008

This looks like a good way. Check this Stackoverflow thread for more information about this object:

http://stackoverflow.com/questions/15902935/what-is-the-significance-of-currentstyle

1 reply

smacdonald2008
smacdonald2008Accepted solution
New Participant
October 16, 2015

This looks like a good way. Check this Stackoverflow thread for more information about this object:

http://stackoverflow.com/questions/15902935/what-is-the-significance-of-currentstyle