You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Dan Allen <da...@mojavelinux.com> on 2003/03/15 07:07:37 UTC

Re: Basic Doubt Regarding Initialization of ActionForm when invoked a jsp page

>     I have a basic doubt regarding initilization of ActionForm in an
> application.
> 
> Example:
> 
> I have a login.jsp.
> In login.jsp I have <html:form action="login.go">
> 
> For this action I configuration Action and ActionForm classes.
> 
> I configured servlet-mappings:
> 
>   <!-- Standard Action Servlet Mapping -->
>   <servlet-mapping>
>     <servlet-name>action</servlet-name>
>     <url-pattern>*.go</url-pattern>
>   </servlet-mapping>
> 
> 
> How the ActionForm initilizes if i called login.jsp directly in browser
> (http://localhost:8080/myApp/login.jsp)
> 
> I think the above request won't go through ActionServlet. I think
> ActionServlet will initilizes the ActionForm.
> 
> When this ActionServlet intilizes the ActionForm? While form submits or
> while loading login.jsp.
> 
> If it loads while loading login.jsp how the ActionServlet initialized
> ActionForm.

Ah, the very same question I started this list with.  When you
request a *.jsp directly, the ActionServlet never get's called at
all.  However, the <html:form> tag will bend over backwards using
RequestUtils to create a new form-bean if one does not already
exist, hence using a backdoor into the struts configuration file
(which is read into memory when the application is started).  Most
people around here shun using direct access to *.jsp files unless it
is a coverpage, and even then they go with a redirect to an action.

So no, ActionServlet plays no part in that request, but thanks to
the Struts taglib, access is still gained to the mapping
confirguartion from web.xml and struts-config.xml

Dan

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, <da...@mojavelinux.com>
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
[Frodo]: "He deserves death." 
[Gandalf]: "Deserves it! I daresay he does. Many that live 
deserve death. And some that die deserve life.  Can you give 
it to them?  Then do not be too eager to deal out death in 
judgement. For even the very wise cannot see all ends."
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org