• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 567
  • Last Modified:

Understanding JSP custom tags and javascript...

Hi, I am a novice in JSP custom tags and I would like to learn in detail what the following lines of code is doing and what is happening b/c I am confused about the mixing of javascript, custom tags and <jsp:usebean> tags...:

<script language="JavaScript" type="text/JavaScript">
...
<control:iterator id="winFeature" collection="<%=tree.getData().getwinFeatures()%>">
      putWinFeatures("<jsp:getProperty name="winFeature" property="winId"/>", "<jsp:getProperty name="winFeature" property="winFeatureConcat"/>");
</control:iterator>
...
</script>


Thanks,
G.
0
gen228
Asked:
gen228
  • 5
  • 4
1 Solution
 
TimYatesCommented:
The control: bit will be executed on the server (when the JSP is building up the HTML page to send to the client)

From the looks of things, it will loop round the elements in:

tree.getData().getwinFeatures()

and add a "putWinFeatures" javascript function call for each one...
0
 
TimYatesCommented:
then, this "built up" html page will be sent to the client...
0
 
TimYatesCommented:
And whatever "tree.getData().getwinFeatures()" returns, it is a class with at least 2 properties...

winId and winFeatureConcat

-- the methods called will be getWinId() and getWinFeaturesConcat()
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
gen228Author Commented:
Thank you TimYates!  I have been analyzing the code, I will get back to you!

Thanks,
G.
0
 
gen228Author Commented:
Hi TimYates, so from my understanding, <jsp:getProperty... can get any property on a jsp page and in this case, from the <control:iterator> custom JSP tag.  

Thanks,
G.
0
 
TimYatesCommented:
yeah...

the

<control:iterator id="winFeature" collection="<%=tree.getData().getwinFeatures()%>">

line stores the current bean from the loop in the variable called "winFeature"

then

<jsp:getProperty name="winFeature" property="winId"/>

calls "getWinId()" and

<jsp:getProperty name="winFeature" property="winFeatureConcat"/>

calls "getWinFeatureConcat()" on that object :-)
0
 
gen228Author Commented:
Thank you so much TimYates  !  Your explainations were very clear and excellent!  

Thanks again,
G.
0
 
TimYatesCommented:
Glad I could help :-)

Good luck with it all :-)

Tim
0
 
gen228Author Commented:
Hi Tim!,  I have the question thread: "java.lang.ClassCastException inside jsp..." http://www.experts-exchange.com/Web/Web_Languages/JSP/Q_21223807.html open.
If possible, can you take a look?

Thanks so much,
G.
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now