You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by slideharmony <se...@tiscali.it> on 2007/11/20 10:49:42 UTC

Access the value stack

How can I access the value stack in my action in order to store objects(that
I want to retrieve in my jsps)?
-- 
View this message in context: http://www.nabble.com/Access-the-value-stack-tf4842284.html#a13853727
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Access the value stack

Posted by Omkar Patil <os...@gmail.com>.
One way is by having following code in your action - 

ValueStack valueStack = ActionContext.getContext().getValueStack();

-Omkar


slideharmony wrote:
> 
> How can I access the value stack in my action in order to store
> objects(that I want to retrieve in my jsps)?
> 

-- 
View this message in context: http://www.nabble.com/Access-the-value-stack-tf4842284.html#a13855222
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Access the value stack

Posted by Dave Newton <ne...@yahoo.com>.
You don't need to access the value stack directly in
order to access action properties in a JSP. The action
itself is pushed on to the stack allowing any member
with a public "getter" method to be accessed.

Action:
public class MyAction {
    private String _foo = "Hello";
    public String getFoo() { return _foo; }
}

JSP:
<%@ taglib prefix="s" uri="/struts-tags" %>
<s:property value="foo"/> <!-- outputs "Hello" -->
${foo} <!-- outputs "Hello" in JSP 2.0 container -->

d.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org