This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes write jsp code in c:when tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "write jsp code in c:when tag" Watch "write jsp code in c:when tag" New topic
Author

write jsp code in c:when tag

JayaSiji Gopal
Ranch Hand

Joined: Sep 27, 2004
Posts: 303
I have a drop down with certain name/value pairs.
The value reads as <%=template.getComp_id().getTemplateId().toString()%>

in order to write the same code in jstl, would it be
${param.comp_id.templateId} where param = template ?

Thank you,
Jayashree.


SCJP 1.4, SCWCD 1.4<br /> <br />Thanks in advance!<br />Jayashree.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

It would depend on your template object.
What is it?
Is it bound to one of the scoped objects?

In any case, you wouldn't use 'param' unless it were a querystring or form parameter; which I doubt because form parameters don't support two levels referencing.
[ August 14, 2007: Message edited by: Ben Souther ]

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
JayaSiji Gopal
Ranch Hand

Joined: Sep 27, 2004
Posts: 303
the template object is an object retreived from session. it is a bean with some attributes.

so if i have <c:set var="param" value="$sessionScope{a}"> ahd the java code,is <%=param.getCompID().getTemplateID()%>

is there a way to put $param.compId.templateID within the test of <c:when tag.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Again, 'param' is not a good name for a variable.
It is one of the implicit EL variables.

If you named it something else, yes, you could compare the value of one if it's properties to something else in the test attribute of a c:when or c:if tag.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60741
    
  65

<c:set var="param" value="$sessionScope{a}">


param is an implicit name in the EL -- choose something else.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
Don't get me started about those stupid light bulbs.
 
subject: write jsp code in c:when tag
 
Similar Threads
Using Split instead of StringTokenizer
JSP Custom Tag Lib
send checkbox values from a jsp to other jsp
How do I replce NULL with "" Nothing at all??
jsp stay with text fields