File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Question regarding the logic:iterate tag Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Application Frameworks » Struts
Reply Bookmark "Question regarding the logic:iterate tag" Watch "Question regarding the logic:iterate tag" New topic
Author

Question regarding the logic:iterate tag

kay lin
Ranch Hand

Joined: May 20, 2004
Posts: 132
Hi:
I just started learning STRUTS and coding application using STRUTS not long ago, so if my quesiton seems trivial to you, please bear with me

Here is a couple of questions regarding the <logic:iterate> tags,

I know that <logic:iterate> must have a required attribute: - id and here is the definition of "id" directly quoted from the apache web site

"id - The name of a page scope JSP bean that will contain the current element of the collection on each iteration"

can somebody tell me exactly what a "page scope JSP bean" is? and also, what does it mean by "page scope"?

suppose i have the following



and in my JSP page, i have my STRUTS tags laid out as the following


now in this case, is "transaction" the name of a JavaBean class? or it is more like an iterator to "inquiryResults" (an array List)
also <bean write: name='transaction' property='PRKey'/>, the "name" attribute of <bean:write> specifies the attribute name of the bean whose property is accessed to retrieve the value specified by property (if specified). Then does that mean in this case 'transaction' also represents the JavaBean class who has a field called "PRKey" and a getter and setter methods called getPRKey() and setPRKey()?

please let me know. By the way, I find the Struts reference on Apache web site are comprehensive, but they tend to be very confusing sometimes. I wish they could explain everything in plain English and provides with some examples, does anyone know anywhere i may find such resources that provide complete Struts Reference, with lots of examples and they are easy to understand? please let me konw


I know this is a long post, So I TRULY appreciate any help

Many THANKS
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 23635

When they say "page scope", they just mean that the bean needs to be accessible on the current page. It can be in the request or session even though it isn't clearly stated.

In your example, transaction is the name of a variable that will hold the current value in the loop. It's just like the temporary value i in a for loop. You could also write it as
and do away with the scriptlet. Your interpretation of the bean write tag is correct.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Certs: SCEA Part 1, Part 2 & 3 & Core Spring 3, OCAJP
 
IntelliJ Java IDE
 
subject: Question regarding the logic:iterate tag
 
Threads others viewed
problem in logic:Iterate
Can I use Struts tags inside plain HTML tags?
can somebody take a look at my struts--config file?
still having problem with logic:iterate tags
Problem with the drop down box using Struts tags
developer file tools