File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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
 
Similar Threads
Design Pattern at Struts
difference in patterns
MVC or Moderate pattern for GUI?
Struts Action class and Action Form
WA #1.....word association