Richard, thanks for your help. I had tried the '#'-syntax before, but it
didn't work either. Yet I found another solution: instead of storing the
'allCrafts' set directly in the value stack via stack.setValue("allCrafts",
allCrafts) as before I create a helper object which exposes an
'allCrafts'-property and *push* that onto the stack. In code:

public class StackValue
{
        private Set m_allCrafts;

        public StackValue(Set allCrafts)
        {
                m_allCrafts = allCrafts;
        }

        public Set getAllCrafts()
        {
                return m_allCrafts;
        }
}

final OgnlValueStack stack = ActionContext.getContext().getValueStack();
stack.push(new StackValue(allCrafts));

Now

<ww:select label="'Craft'" name="'selectedCraft'" size="'1'"
list="allCrafts" ... />

works as expected.

Obviously, I am still confused about the exact semantics of the
OgnlValueStack, but I am getting there ... Well, hopefully.

Regards,
Olaf


> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of
> Richard Taylor
> Sent: Sunday, November 30, 2003 12:37 AM
> To: [EMAIL PROTECTED]
> Subject: RE: [OS-webwork] [WW2] Howto update value stack from
> interceptor?
>
>
> I'm not 100% sure but because your object isn't the root you may have to
> precede the reference with a #.
>
> So in your example you would have ... list="#allCrafts".
>
> Let me know the outcome.
>
> Richard.
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On
> Behalf Of Olaf
> Bergner
> Sent: 29 November 2003 18:07
> To: [EMAIL PROTECTED]
> Subject: [OS-webwork] [WW2] Howto update value stack from interceptor?
>
> A recurring task in my app is to dynamically load a set of objects dubbed
> 'allCrafts'. After making things work by writing various action classes
> which all expose a property 'allCrafts' via 'Collection getAllCrafts()' I
> decided to refactor that functionality into an interceptor. This
> interceptor
> loads said set and stores it in the value stack via
>
> final OgnlValueStack stack = ActionContext.getContext().getValueStack();
> stack.setValue("allCrafts", allCrafts);
>
> However, a
>
> <ww:select label="'Craft'" name="'selectedCraft'" size="'1'"
> list="allCrafts" ... />
>
> in my jsp which used to produce an option list of all crafts won't work
> anymore. How can I access the 'allCrafts' variable in the value
> stack from a
> jsp page?
>
> Thanks,
> Olaf



-------------------------------------------------------
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