HTML Link does not carry the form data. You can either go for different submit buttons or pass the values as parameter to the action link and fetch it accordingly in action class. Use the rewrite tags to hide parameters it from the end users.
Joined: Jan 25, 2010
I had come up with a work-around, similar to your first solution with two Submits.
In the config I created two mappings, each going to the same Action, one mapping each from the two links with different actions, ie, <html:link action="/chooseDataStoreTypeDataBase"> for one and <html:link action="/chooseDataStoreTypeArray"> for the other. The config entries:
The trick was creating an Interface that each of the mapping's form extended. Each form had a different literal, eg, one form had private static final String dataStoreType = "array"; and the other private static final String dataStoreType = "dataBase";. Thus, in the Action I could test the Interface and polymorphically determine which Link sent the request.
I've since modified my solution by utilizing request.getRequestURI() in the Action.
Maybe not the most elegant solution, but it seems reasonable.
I included alot of the above code in case someone can use it later.
Jaimesh M Ponkia
Joined: Nov 24, 2010
If you were using the hidden variable only to determine which link was clicked then you can go for using LookUpDispatchAction and set the action according to your link. This way you will not have to make 2 entries in struts-config and not worry about requestURI.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: jsp hidden field not populated in ActionForm