File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Struts Flow of Execution with no form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Flow of Execution with no form" Watch "Struts Flow of Execution with no form" New topic

Struts Flow of Execution with no form

karthik chellappan
Ranch Hand

Joined: Jul 01, 2007
Posts: 31
I was going through struts flow and i got how it works when a form is submitted .But then i saw few struts application in which no forms were present and jsp page simply forwards the request to the one action like this .
Eg :

Even though form is not there,action is mapped to one form bean class in the action mapping tag in struts-config.xml:

values for the form bean class was populated in Execute method of Action Subclass using setter method of form bean class like this :

now normally if form is there ,
(i)RequestProcessor identifies the Action class and it checks the whether the request is associated with any form bean.This can be checked by using the name attribute of the action element from the struts-config.xml.
(ii)The RequestProcessor instantiates the UserForm and puts it in appropriate scope either session or request and iterates through the HTTP request parameters and populates the CustomerForm properties of the same.
(iii)Next, the RequestProcessor checks for the validate attribute in the ActionMapping.If any error then it checks for the input attribute in the ActionMapping and forward to page mentioned in the input tag.If no error in validate() method then continue.
(iv)The RequestProcessor instantiates the Action class specified in the ActionMapping (UserAction) and invokes the execute() method .

so in the above application ,

(i) in which order instances will be created ?
(ii)what is exactly the flow [if there is any change ]?

i've this doubt because ,here form bean class is populated in execute method only ,which is not the case when form is present ... so what is exactly happening here ?

thanks ...

karthik chellappan
Ranch Hand

Joined: Jul 01, 2007
Posts: 31
hi ,

if anyone could tell what is happening in the above example ,it would be of great help to clear my concept ...

I agree. Here's the link:
subject: Struts Flow of Execution with no form
It's not a secret anymore!