aspose file tools*
The moose likes Struts and the fly likes Select and trigger an action through a link, doesn't populate the value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Select and trigger an action through a link, doesn Watch "Select and trigger an action through a link, doesn New topic
Author

Select and trigger an action through a link, doesn't populate the value

Anand Krishnanandam
Greenhorn

Joined: May 23, 2006
Posts: 25
In my jsp page there is a <s:select tag and there links that triggers three different actions.
I want the selected option in one of the actions.

For example: there are accept, reject and review links to respective actions. And a select tag for comments to be sent to accept action.

I don't see the selected value being populated in the Accept action.



There is a getter and setter for commentId in the accept action which is not being populated when I select and then click the Accept link

I even tried



Please let me know where I'm going wrong.
Thanks,
Nithya.
Tom Rispoli
Ranch Hand

Joined: Aug 29, 2008
Posts: 349
I believe the problem with your first method is that when you click on the links you created, the form does not get submitted, so the value of the select tag isn't part of the request.

The problem with your second method is that your parameter is being set before the page is displayed to the user (when the jsp is run), so the parameter won't change when a user selects a different value in the check box.

If you want to use links rather that submitting the form I think you'll have to use javascript to append the parameter to the URL for the link.
Anand Krishnanandam
Greenhorn

Joined: May 23, 2006
Posts: 25
Thanks for explanation.. That worked perfect.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Select and trigger an action through a link, doesn't populate the value
 
Similar Threads
[Struts 2] How to populate select control after selection of a value in another select control
populate items using struts2 <s:select>
Struts2 - Select - Ajax
<s:property value=""> in comparison
multiple dropdown interdependant on the previous selected dropdoen value