I have a jsp as my view, which displays a form for adding a new user/ updating the user, if one is selected. I can’t figure out how to prepopulate my form if a user is selected. I read about the solution using 2 actions, with the same form, one of which is just used to populate the fields, and on for submitting the data.
However, this doesn’t work for me, as my action (the one defined in action attribute for the form) isn’t called when loading the jsp (can’t really explain this either, the menu and pages are defined in an xml file). I don’t understand how to specify the second action in my jsp, and how to make sure that the action is called when first loading the jsp. I would prefer a solution not involving AJAX, if possible. Thanks.
I have a jsp as my view, which displays a form for adding a
Share
Why do you want to go for AJAX, when you have the power of Struts. I have a simple example (it is tested) for you.
MyForm.java
MyFormSetupAction.java
MyFormSuccessAction.java
struts-config.xml
home.jsp
success.jsp
Everytime you call the home.do action, the fullName property is populated with “tusar”. Just comment if you need any further association, I’ll be happy to help you. Thanks!