Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

get data from valueStack inside an action

 
Armin Vetek
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Of course--OGNL (and JSTL) resolve against the value stack. That's how Struts 2 works.
 
Armin Vetek
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic