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 Tracking a request in struts 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 "Tracking a request in struts" Watch "Tracking a request in struts" New topic
Author

Tracking a request in struts

Abebe Belew
Greenhorn

Joined: Jul 21, 2004
Posts: 19
My index page has two links "checking" and "saving" and I want to use the same <action-mapping> in the struts-config.xml file since both do the same thing except for one thing, which is

in my jsp page I have a hidden field:
<input type="hidden" name="check_save" value="1">

when clicking on "checking" I want the value of "check_save" to be "1" and
when clicking on "saving" I want the value of "check_save" to be "2", since the query I do in my bean differes according to the value.

the question is since both links use the same action how do I track where the request is coming from "checking" or "saving" to change the value of "check_save" accordingly?
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

I recommend using two ActionMappings but have them both use the same Action. You can use the different ActionMappings to specify the parameter you desire. This can be done using the parameter attribute of the ActionMappings in struts-config.

Having two Actions really isn't that bad of an idea either.


A good workman is known by his tools.
Abebe Belew
Greenhorn

Joined: Jul 21, 2004
Posts: 19
I am not quite sure what you suggested since I am new to struts.
can you please give me an example?
[ December 03, 2004: Message edited by: Abebe Belew ]
Abebe Belew
Greenhorn

Joined: Jul 21, 2004
Posts: 19
does anybody have an example of how to use the property parameter in Action Mapping to solve the above mentioned question?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tracking a request in struts