Magically! Webwork automatically does all that for you, as long as a getAlbum method exists in that item in the collection, it'll work. Your jsp pages don't need to know anything about types or classes. The webwork tags are all valuestack-aware, as in they will know how to resolve expressions and do the appropriate java magic to get it working.

PS I'd strongly recommend figuring out how webwork works WITHOUT looking at the source first, and just using the docs.

On Nov 18, 2003, at 9:25 PM, Rajagopal. V wrote:

Hani
Thanks for the reply. I did take a look at CDList
class and the one thing thats puzzling me is that in
the doStartTag and doAfterBody of IteratorTag, all its
doing is a iterator.next() which should return a
Object. My problem is how does that automatically get
cast down to a CD Class.
I come from a Struts background and in that case, the
logic:iterate has a type attribute which specifies
what is the type of the individual elements in a
Collection.  I couldnt find a similar match in
Webwork.

Thanks
Raj

--- Hani Suleiman <[EMAIL PROTECTED]> wrote:
have a look at the webwork.examples.i18n.CDList
class. That is the
action class, so when the page makes a call to
CDList, that
automatically calls the getCDList method in that
action class. The
CDList is now iterated through and within the
iterate block, the top of
the value stack now has the current CD at the top,
so when the
propertytag tries to display 'album', the method
called will be
getAlbum() on the particular CD that the iterator
now points at.

On Nov 18, 2003, at 8:25 PM, Rajagopal. V wrote:

Hello
I just started looking at Webwork and checking out
the
examples. One thing i noticed in cdlist.jsp is
this
code
   <webwork:iterator value="CDList">
   <option value="<webwork:property
value="album"/>">
      <webwork:property value="album"/>,
      <webwork:property value="artist"/>,
<webwork:property value="country"/>,
      <webwork:text name="'price'"
value0="@pricer/computePrice(price)"/>
   </option>
   </webwork:iterator>

CDList is actually a List of "CD" objects, but i
couldnt find anywhere in the code where this cast
is
made back. So how does webwork know which object
to
call when the getAlbum() is called?

TIA
Raj

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail
AddressGuard
http://antispam.yahoo.com/whatsnewfree




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback
Program.
Does SourceForge.net help you be more productive?
Does it
help you create better code? SHARE THE LOVE, and
help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]


https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork





-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback
Program.
Does SourceForge.net help you be more productive?
Does it
help you create better code?  SHARE THE LOVE, and
help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]

https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork


__________________________________ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree


------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork




------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to