This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Struts and the fly likes Multiple Controller Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Multiple Controller Servlet" Watch "Multiple Controller Servlet" New topic
Author

Multiple Controller Servlet

Ramadoss
Greenhorn

Joined: May 26, 2004
Posts: 4
Hi
Can J2EE web application contains many controller servlets?

Thank you in advance.

-Ram
Ramadoss
Greenhorn

Joined: May 26, 2004
Posts: 4
Ok let me pull this way since this is a question of wide spectrum.

We have J2EE application which is comprises of multimple modules but basically grouped together as a single application and we have our base servlet which we are extending from ActionServlet.

We have a RequestProcessor class configured and I know that this actually does the controller functionality since we are using Struts1.1.

My question is that given then above scenario can we have multiple controller servlet for this J2EE application ? if yes, How could I impelement the same?

Thank you in advance.

-Ramadoss
David Hibbs
Ranch Hand

Joined: Dec 19, 2002
Posts: 374
You could, but you would have to map a different extension to each controller servlet. This is generally discouraged as it makes the app a mess to try and follow.

Instead, look into the modules feature of Struts. You can create separate modules that each have their own struts config file and correspond to separate paths in the URL, such as
/ContextRoot/module1/
/ContextRoot/module2/
etc.

Because each module is independent, you can specify and maintain all the configuration properties separately as you currently are without resorting to a kludge.



"Write beautiful code; then profile that beautiful code and make little bits of it uglier but faster." --The JavaPerformanceTuning.com team, Newsletter 039.
Ramadoss
Greenhorn

Joined: May 26, 2004
Posts: 4
David:
I appreciate your comprehensive reply. By looking at your point I assumed that theoritically an J2EE application can have many Controller Servlets configured though it is not recomended to do so.

-Ramadoss
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multiple Controller Servlet