This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes Passing a value from a JSP page to an Action to get some data after processing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Passing a value from a JSP page to an Action to get some data after processing" Watch "Passing a value from a JSP page to an Action to get some data after processing" New topic
Author

Passing a value from a JSP page to an Action to get some data after processing

Stan Pak
Greenhorn

Joined: Feb 11, 2010
Posts: 9
Hi all,

I want to make this logic.

[JSP page] ---pass a value---> [Action class] ---select using the value and return---> [JSP page]

The value is Product Group ID.
The Action class should return a Product List to the JSP page by selecting products using the Product Group ID.

So I'm using Struts2 Tag on the JSP page like this..


Is there something wrong with it?
Because that code didn't return any value.

I tested the method(getGroupRelData) like this.


Nothing printed. No error.

The value printerGroupID in the JSP page is ok. Because I tested the value like this.

I could see the value when I ran the JSP page.

I think there is something wrong with this sentence.
<s:iterator value="@collect.CollectMainData@getGroupRelData('#printerGroupID')">

Is it right? I'm looking forward to your answer. Thanks.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Remove the "#".
Stan Pak
Greenhorn

Joined: Feb 11, 2010
Posts: 9
As you said, I removed the "#" and tested, but nothing changed.
The method wasn't even executed.

Is this right?(especially the bold part)
<s:iterator value="@collect.CollectMainData@getGroupRelData('printerGroupID')">
Stan Pak
Greenhorn

Joined: Feb 11, 2010
Posts: 9
Resolved!

That because I didn't set to access static method.

I made a file "struts.properties" and write "struts.ognl.allowStaticMethodAccess=true" in the file.

Hooray!
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Ah, yes, that'd do it--glad you figured it out!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Passing a value from a JSP page to an Action to get some data after processing
 
Similar Threads
how to display database values in a table
Struts2 - <s:iterator> in two-Dimensional Array.
Iterating over HaspMap<String,List<Object>> and comparing values.
Sticky nested lists problem in Struts 2
struts 2 iterator