Hi, is it 'correct' to define both the doGet() and doPost() methods in a servlet (as in programatically correct) in order to keep the number of servlets loaded to a minimum or would it be better to only implement one per servlet but have more servlets (in an attempt to simplify design?)... Is this personal preference? Thanks again.
Hi Chris How does defining doGet() and doPost() affect the number of servlets loaded ?? it entirely depends on the requirement...whether u want to define doGet or doPost. BTW...u can define one and call it in another to achieve same functionality in both the methods. [ September 30, 2003: Message edited by: Neeraj Singhal ]
Joined: May 22, 2003
I meant that, I might choose to define only one of the methods per servlet thereby needing more classes to do the same functionality as i would need if i had declared both methods.
"more classes to do the same functionality" Well, that alone states that it would be a bad design of OOP principles. You want to keep functionality in one location and anyone that needs that functionality can call that one method. It is easier to maintain and enhance. Sometimes you might want to consider pulling logic out into its own "helper class" that all Servlets can use and call. Mark