Best approach for getting component field values from currentStyle or properties object | Adobe Higher Education
Skip to main content
Level 4
October 16, 2015
Risolto

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

  • October 16, 2015
  • 1 risposta
  • 528 visualizzazioni

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.
Questo argomento è stato chiuso alle risposte.
Migliore risposta di 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 risposta

smacdonald2008
Level 10
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