I have a struts application in which on first form I just display few buttons. Idea is that user clicks on a button, and different jsp page is shown to user.
(html:submit code repeats for all buttons assigning different values to "action" property) ======================================================
This property is retrieved in WelcomeAction as follows. ====================================================== String action = (String)((WelcomeForm)form).getAction(); ======================================================
Secondly I did change the name of 'action' to 'adminaction' still no luck. I am still not getting values in the Form or in Action. There is something very subtle I am doing wrong and I can't figure out what
Joined: Feb 15, 2005
When you changed the property to "adminaction", did you remember to also change the property and getter/setter in your ActionForm? If you're using this in a DispatchAction, did you remember to change the "property" attribute of the action path?
Also, I'd be wary of using the "forms" construct. This assumes that the form is the first form on the page. If you make this JSP part of a tiles template, this may no longer be the first form. I prefer using the actual name of the form, which in Struts is what you specified as the name attribute of the action mapping in your struts-config.xml file. Exmple:
Merril, your following directions really helped. THANK YOU!
>I prefer using the actual name of the form, which in Struts is what you >specified as the name attribute of the action mapping in your struts->config.xml file. Exmple: >document.myForm.adminaction.value="xyz"
Even though it was first and only form in jsp, and even though I am not using tiles, for some reason, forms did not set values. After changing to the form name, everything is working as expected. For some reason same code (i.e. with forms) is working in other jsp correctly. But for safety there too I will introduce form name.