Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Best strategy to write Controller Servlet ?

 
Nitin Dubey
Ranch Hand
Posts: 126
Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello folks,

What is the best strategy to write a controller servlet ?

Regards,

Nitin Dubey
 
Nitin Dubey
Ranch Hand
Posts: 126
Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do not invent the wheel
better take Struts, SpringMVC, WebWork or something like this.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64632
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not agree that adopting a complex framework is always the best solution.
 
Nitin Dubey
Ranch Hand
Posts: 126
Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This thread might be helpful.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic