Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

action servlet

 
Ranch Hand
Posts: 644
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you extending ActionServlet which struts framework provide?

Just curious to know what your MainAction class do?
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at its parent/ancestors for the methods.
 
trupti nigam
Ranch Hand
Posts: 644
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The actionServlet extends "org.apache.struts.action.ActionServlet"
class.
What is this ancestor /parent methods?

Thanks,
trupti
 
trupti nigam
Ranch Hand
Posts: 644
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
 
Ranch Hand
Posts: 415
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 644
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 415
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic