aspose file tools*
The moose likes Servlets and the fly likes Best strategy to write Controller Servlet ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Best strategy to write Controller Servlet ?" Watch "Best strategy to write Controller Servlet ?" New topic
Author

Best strategy to write Controller Servlet ?

Nitin Dubey
Ranch Hand

Joined: Oct 30, 2000
Posts: 126

Hello folks,

What is the best strategy to write a controller servlet ?

Regards,

Nitin Dubey
Nitin Dubey
Ranch Hand

Joined: Oct 30, 2000
Posts: 126

I myself is replying first coz I have a solution but I don't know if its the best strategy.

We will have a properties file that has key as "ServletName_ForwardName" and servlet path as value. A class with a method like "loadControllerParams()" will load the properties in a static hashmap at startup with the help of a servlet that is loaded at container startup. We will define a static boolean value that will determine if the controller parameters should be loaded each and every time or only once at container startup.

Now the Servlets and JSPs just need to fetch the forward servlet name like

ControllerParamFile.hashMap.get("ServletName_Forward");

Please comment or suggest any better idea than this one,


Nitin Dubey
Eugene Lucash
Ranch Hand

Joined: Feb 19, 2005
Posts: 77
Do not invent the wheel
better take Struts, SpringMVC, WebWork or something like this.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

I do not agree that adopting a complex framework is always the best solution.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Nitin Dubey
Ranch Hand

Joined: Oct 30, 2000
Posts: 126

We are not in a stage to adopt a change in technology. If we were in a situation to change the technology I probably would have posted the question itself.

Any comments on the servlet I am trying to develop ? Any better solutions if available.

Nitin Dubey
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
This thread might be helpful.
 
Consider Paul's rocket mass heater.
 
subject: Best strategy to write Controller Servlet ?