Yup... "that" does the trick.

----- Original Message ----- 
From: "Hendrik van der Linde" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, October 02, 2003 4:28 PM
Subject: Re: [OS-webwork] Value Stack Magic


> Hello,
> 
> What Adam probably means is that he wants the class instance, instead 
> of some field value. I have been puzzling at this too. Suppose you are 
> iterating over a List and you want to pass the _whole_ top stack object 
> to an action (maybe inside an URL), how do you do that? What I have 
> found thus far is that Ognl 'translates' everything to a string (or 
> String[]???). It would be nice to know if there is a way to cast, or 
> specify the class of the object you want to pass to the action. 
> Something like:
> 
> <a href="<ww:url value="editoption.action"><ww:param name="entry" 
> value="(EntryClass) that" /></ww:url>">edit3</a>
> 
> Where 'that' is the object at the top of the stack (aka [0] aka that 
> ;-) ). Is something like this possible? How does Ognl handle type 
> casting? If it doesn't how do others handle data objects (Beans)?
> 
> greets, Hendrik
> 
> On donderdag, okt 2, 2003, at 00:53 Europe/Amsterdam, Matt Ho wrote:
> 
> > If you're trying to toString() [EMAIL PROTECTED], then call
> >
> > <ww:property value="[1].toString()"/>
> >
> > A value stack is essentially a List.  Calling [1] on the stack, 
> > returns a substack beginning with the element at index 1.  It's only 
> > when you call methods on the stack that your actual objects will be 
> > called.
> >
> > Said another way, let's say I have a value stack that consists of a 
> > model and an action as follows:
> >
> > [ model, action ]
> >
> > here's how the following ognl would resolve:
> >
> > [0] - a CompoundRoot object that contains our stack, [model, action]
> >
> > [1] - another CompoundRoot that contains only [action]
> >
> > [0].toString() - calls toString() on the first object in the value 
> > stack (excluding the CompoundRoot) that supports the toString() method
> >
> > [1].foo - call getFoo() on the first object in the value stack 
> > starting from [action] and excluding the CompoundRoot that supports a 
> > getFoo() method
> >
> > I hope this doesn't sound too confusing :\
> >
> > If you're using Velocity, this can most easily be written as:
> >
> > $stack.findValue("[0]").peek()
> >
> > Unfortunately, <ww:property value="[0].peek()"/> won't work as this 
> > would translate into "starting at the top of the value stack (and 
> > excluding the CompoundRoot), find the first object that has a method 
> > called peek()"
> >
> > Cheers!
> >
> > M
> >
> > Adam Fleming wrote:
> >
> >> I'm trying to get something on the Value Stack from withing a 
> >> ww:iterator tag,
> >> i use this:
> >> ww:property value="[1]"
> >> and get something like:
> >>  [ [EMAIL PROTECTED], [EMAIL PROTECTED] ]
> >> What is the OGNL to get theClassIwant?  I'm not looking for some 
> >> property of the class, but the class itself.
> >> thanks!
> >> -------------------------------------------------------
> >> This sf.net email is sponsored by:ThinkGeek
> >> Welcome to geek heaven.
> >> http://thinkgeek.com/sf
> >> _______________________________________________
> >> Opensymphony-webwork mailing list
> >> [EMAIL PROTECTED]
> >> https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
> >
> >
> >
> >
> > -------------------------------------------------------
> > This sf.net email is sponsored by:ThinkGeek
> > Welcome to geek heaven.
> > http://thinkgeek.com/sf
> > _______________________________________________
> > Opensymphony-webwork mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
> >
> 
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Opensymphony-webwork mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
> 


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to