This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Struts and the fly likes get data from valueStack inside an action Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "get data from valueStack inside an action" Watch "get data from valueStack inside an action" New topic
Author

get data from valueStack inside an action

Armin Vetek
Greenhorn

Joined: Aug 21, 2010
Posts: 29
Hi,

I have a jsp page which consists from some criteria fields and jquery-grid. The forms looks like that:
criteria field1 -----------------
criteria field2 -----------------
criteria field3 ------------------
search_button

table - jquery grid
--------------------------------------
--col1 -+- col2 -+- col3 -
--------------------------------------
value1 value2 value3

FormAction is called when search_button is pressed. Values from FormAction are put on ValueStack.
JSonAction which is used to render a jquery grid table is called from the jsp page. I would like to read criteria fields which are stored on ValueStack from another action (JSonAction).

Is it possible to get a value from ValueStack inside an action in struts2?

Regards,
Javanus


http://www.javanus.com/blogs
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Of course--OGNL (and JSTL) resolve against the value stack. That's how Struts 2 works.
Armin Vetek
Greenhorn

Joined: Aug 21, 2010
Posts: 29
Hi,

I understand how to get the value from valueStack in jsp.

I do not know how to get the value from ValueStack inside an action.
Struts ValueStack Debug shows the following:
Value Stack Contents
Object Property Name Property Value
dao.RequestAction status NEW

Code below returns null. I would like to get the value for status field from object dao.RequestAction. I tried the following:
ValueStack stack = ActionContext.getContext().getValueStack();
System.out.println("Status = " + stack.findString("dao.RequestAction"));

Could you give me a tip?

Regards,
Javanus
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: get data from valueStack inside an action