When use productEdit.do?prod=8 and the validation-method in the ActionForm find an error in the form then it redirect to productEdit.do But i can't call the jsp without any prod-parameter.
Can i use your solution for my problem? I can't imagine how to use the property in this case. [ June 07, 2008: Message edited by: Robert Wundisch ]
Joined: Feb 15, 2005
This application would be fine for a regular Servlet/JSP project, but it is not a good Struts project. The main problem is that there is too much logic in the JSP. The Struts way is to do as much as possible in the Action and as little as possible in the JSP. This wouldn't work at all with Struts validation because if the page were redisplayed because of an error, it would revert back to the original database values, and not display the values entered by the user.
I'd suggest you refactor as follows:
Create a new PrepareProductEdit Action that forwards to this JSP and call the action in your link or URL instead of the JSP
Change the parameter that is passed from prod to prodID and make it so the ProductEditForm bean has the same properties as the Product class
Add logic to the new PrepareProductEdit Action to get the data from the database and populate the ActionForm bean's properties
Remove all Database retrieval logic from the JSP
Remove all value attributes from the Struts html:text tags. Struts will automatically populate the value of these fields with the value of the ActionForm properties
Here's an example of what I'm talking about:
[ June 07, 2008: Message edited by: Merrill Higginson ]
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