Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Iterate tag

 
Mary Cole
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
Y do I get the following values when I use the iterate tag

${ul.firstName} ${ul.lastName}

Inside the iterate tag, I use the follwing EL

<c ut value="${ul.firstName}"/>  <c ut value="${ul.lastName}"/>

At runtime its displaying the above results

Thx in advance
 
Sree Jag
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check if the tag lib is mentioned at the top of the JSP.

-Seshu
 
Mary Cole
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it is mentioned.....

<%@ taglib uri="/WEB-INF/lib/c.tld" prefix="c" %>
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Inside a logic:iterate tag?

Well, the logic:iterate sets its value (id) as a Java reference variable. As far as I know, JSTL only communicates with variables set to pageContext.

Try using a c:forEach to achieve the iterating functionality. c:forEach will set its values to pageContext so the c ut tags can read them.

Worse case scenario you can use bean:write instead of c ut... but I'd rather lead you towards JSTL and away from bean and logic tags.
 
Tad Dicks
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've heard/been told to stay away from EL, because the performance is rather poor, something about every single page view requiring a compilation. I like using the struts tags, I've used a few of the JSTL tags, but anytime I've used EL I've been kind of put off by tryning to get the EL variables to work with any other scripting variables.

Is there any truth to the poor performance? and is there any easy way to get the EL variables to work with other scripting variables?

-Tad
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Tad Dicks:
Is there any truth to the poor performance? and is there any easy way to get the EL variables to work with other scripting variables?


The performance shouldn't be any worse than the Struts tags. Every page view does not require compilation, although if it did that WOULD be horrible on performance. If you want it to work well with scripting variables you'll have to set them to context:
pageContext.setAttribute("myVariable", myVariable);

You should be able to accomplish just about everything you could need without using scriptlets. If you avoid scriptlets & logic/bean tags, this context/compatability becomes a non-issue.
 
Mary Cole
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got it working with the Struts Iterate tag and the bean:write
But when am building the list ,every row has a check box and I need to associate the value of the firstname with that checkbox so that I can delete that particualr name from DB.
How can I do using <html:checkbox
 
Mary Cole
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pls its urgent
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your question is large in scope. I recommend consulting the Struts user guide for help with the use of html:checkbox, try out what you can, and if you absolutely can't figure it out go ahead and post your progress with a request for some help. Otherwise, it looks like you are asking others to do your work for you without putting any effort in it yourself.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic