I am doing this (doing the GET to the action class to prepopulate the form) and it works well but there was one interesting thing that happened (assuming I have everything set up right). The validate() method in the related form bean was called as well. Consequently, I am having to start all of my validate() methods with: if (request.getParamater("submit") == null) so that I don't do edit checking on a GET ... No big deal, but am I missing something?
-----Original Message----- From: Ted Husted [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 09, 2001 9:01 PM To: [EMAIL PROTECTED] Subject: Re: PrePopulating a form The trick is to route control through an Action before display any JSP. The Action does all the real work, like populating the form. The JSP just displays the result. http://jakarta.apache.org/struts/userGuide/building_controller.html -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel +1 716 737-3463 -- http://www.husted.com/struts/ Minh Tran wrote: > > Could somebody let me know what the correct design pattern under struts is > for prepopulating a form with data.. let say.. for example after someone > logs on.. so a form is automattically filled out with their appropriate data > for certain fields.. while some fields still need to be filled out.. I've > got the validation and error handling part down.. > > Of course the obvious way to do this.. to my limited knowledge of struts is > to some how create the form bean and populate it before is is displayed > through the JSP... which I think will automatically retreive whatever data > that's in the form bean.. but i'm still not sure how to make struts creat > the form bean before the form gets display.. it seems that the form beans > gets created after the form is submitted so that it can be validated.. > > Thanks, > Minh Tran