• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Best strategy to write Controller Servlet ?

 
Ranch Hand
Posts: 126
Oracle
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do not invent the wheel
better take Struts, SpringMVC, WebWork or something like this.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This thread might be helpful.
 
reply
    Bookmark Topic Watch Topic
  • New Topic