I believe this is similiar to the issue I had when I ported over the URLTag.
I think you meant to say that the following line will return null when
called outside of an action execution:

OgnlValueStack stack = ActionContext.getContext().getValueStack();

I have also been working on the BeanTag and here's what I'm using:

if (stack == null) {
    stack = new OgnlValueStack();
    stack.setContext(Ognl.createDefaultContext(null));
    ActionContext.getContext().setValueStack(stack);
}

stack.push(bean);

I haven't had a chance to really test everything, but my current version
seems to work ok. Take a look and see if you can use/add anything.

-Brock


> A question about the ActionContext class, when I do the following:
>
> OgnlValueStack stack = ActionContext.getContext().getValueStack();
>
> It will never return null, even if an ActionContext has yet
> to be created. This causes a problem in the BeanTag that I'm
> trying to port over. If the BeanTag is run in a view as a
> result, it works.
>
> If run on its own in a jsp, it doesn't work because of the
> problem noted above. The code looks something like this:
>
> OgnlValueStack stack = ActionContext.getContext().getValueStack();
>
> if (stack == null)
>   createActionContext();
>
> Any ideas, or am I missing something here?
>
> rick
>

What does createActionContext() do?


-------------------------------------------------------
This SF.net email is sponsored by:
The Definitive IT and Networking Event. Be There!
NetWorld+Interop Las Vegas 2003 -- Register today!
http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Attachment: BeanTagTest.java
Description: Binary data

Attachment: BeanTag.java
Description: Binary data

Reply via email to