aspose file tools*
The moose likes Struts and the fly likes Iterate tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Iterate tag" Watch "Iterate tag" New topic
Author

Iterate tag

Mary Cole
Ranch Hand

Joined: Dec 02, 2000
Posts: 362
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

Joined: Oct 14, 2003
Posts: 77
Check if the tag lib is mentioned at the top of the JSP.

-Seshu


Sree Jag<br />SCJP 1.4
Mary Cole
Ranch Hand

Joined: Dec 02, 2000
Posts: 362
it is mentioned.....

<%@ taglib uri="/WEB-INF/lib/c.tld" prefix="c" %>
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

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.


A good workman is known by his tools.
Tad Dicks
Ranch Hand

Joined: Nov 16, 2004
Posts: 264
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

Joined: Feb 05, 2003
Posts: 4727

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

Joined: Dec 02, 2000
Posts: 362
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

Joined: Dec 02, 2000
Posts: 362
Pls its urgent
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Iterate tag