IntelliJ Java IDE
The moose likes Struts and the fly likes action servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Application Frameworks » Struts
Reply Bookmark "action servlet " Watch "action servlet " New topic
Author

action servlet

trupti nigam
Ranch Hand

Joined: Jun 21, 2001
Posts: 568
Hello all,

The actionServlet serves as the controller in the MVC design pattern.
The project I am working on has many action classes ,action forms and the jsp pages . There is only one actionServlet. But it has only init() and destroy() methods.


I read on the jakarta side that..

For each request made of the controller, the method process(HttpServletRequest, HttpServletResponse) will be called. This method simply determines which module should service the request and then invokes that module's RequestProcessor's process method, passing the same request and response.

We don't have any process() method declared in the actionServlet. So how it is determined that for the incoming request which action to invoke?
We have one main action class which extends "org.apache.struts.action.Action" and all other actions classes extend the main action.

Thanks,
trupti
Saritha Penumudi
Ranch Hand

Joined: Aug 18, 2003
Posts: 146
Are you extending ActionServlet which struts framework provide?

Just curious to know what your MainAction class do?
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4695

Look at its parent/ancestors for the methods.


A good workman is known by his tools.
trupti nigam
Ranch Hand

Joined: Jun 21, 2001
Posts: 568
The actionServlet extends "org.apache.struts.action.ActionServlet"
class.
What is this ancestor /parent methods?

Thanks,
trupti
trupti nigam
Ranch Hand

Joined: Jun 21, 2001
Posts: 568
The action class has execute method.
I think we are using the actionServlet just to load the configuration information . is it possible?/
Thanks,
trupti
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4695

The fact that your ActionServlet "doesn't have" a process method led me to believe that the ORIGINAL ActionServlet class was extended without overriding the process method. This seems to be exactly the case. I recommend reading a bit about inheritance to get an understanding of what is going on.

By the way, this is the process method:
sreenath reddy
Ranch Hand

Joined: Sep 21, 2003
Posts: 415
Hi tripti

What u said in the beginning that process will be called is true.....since struts 1.1 ,all the request processiing logic is moved to RequestProcessor class.....and each module will have its own request processor(Each holding the particular modules actionmappings and all ).now what the actionservlet does is depending on the request url it picks up the appropriate RequestProcessor and calls the process method of that ReqProcessor ...........

The introduction of ReqProcessor is just because of the developers choice of providing his own way of hadnling request .but ActionServlet in 1.1 does nothing except intialisations and transferring the request
trupti nigam
Ranch Hand

Joined: Jun 21, 2001
Posts: 568
Sreenath,

We don't have requestProcessors written for each module. We don't have them at all. We have lot of action classes ,form beans, JSP pages and one ActionServlet.

Can some one please let me know the flow of events.From incoming Client request till the reponse is displayed to him. How the request is passed on and hwho is responsible for which action taken?
I tried to read from books but couldn't find the entire flow.

Thanks,
Trupti
sreenath reddy
Ranch Hand

Joined: Sep 21, 2003
Posts: 415
Hi trupti

U r totally going in some different direction .Relook in to what i said in my earlier mail.The requestProcessor is not what u provide ?? thats part of the srruts framework ......

Hope u might be getting something out of this

Do contact me at sreenathn@huawei.com for further details
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4695

What would make things less confusing:

1) Forget about the ActionServlet (and RequestUtils)
2) Check out the struts-config.xml as it is the navigational map of your application

If you can understand ActionMappings from the struts-config.xml everything else will fall into place.
 
IntelliJ Java IDE
 
subject: action servlet
 
Threads others viewed
ActionServlet , RequestProcessor - Flow ?
struts question
Actionservlet is model or controller
Should a project has only one Servlet?
struts-config.xml help
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com