The best approach is to never let the user go directly to a JSP page.
Always pass control through an Action first, which gives you the
opportunity to pre-populate forms, and a number of any other things. 

To prime the pump, you can have the index.jsp forward to an Action.
After that it should always be [action] -> [page] -> [action]

Of course, there is nothing to prevent you from going directly to a JSP,
but in the end, it ends up being more trouble than its worth. Many
people consider it a violation of MVC.

If a form does not need a custom action (yet), you can always use the
standard ForwardAction. 

http://jakarta.apache.org/struts/api-1.0/org/apache/struts/actions/ForwardAction.html

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Java Web Development with Struts.
-- Tel +1 585 737-3463.
-- Web http://www.husted.com/struts/



[EMAIL PROTECTED] wrote:
> 
> Hi all,
> 
> I am new to struts and am working on converting an existing system that we
> have to Struts to get to know the framework for future development. There
> are two questions that really stick out in my mind that I am confused
> about.
> 
> 1. What is the best way to load default values into an ActionForm bean that
> will show up the first time a user visits the site and pulls up a jsp page?
> 
> 2. What is the best way to update a ActionForm bean to output back to the
> JSP?
> 
>   --Say I have an action that updates fields in that bean. Do I do all this
> in the Action class or is there an easier way to do this?
> 
> Thanks for your time and help in advance....
> 
> Tom
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to