Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Question regarding the logic:iterate tag

 
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author & internet detective
Posts: 41967
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic