The web-app I'm currently building follows MVC. I've structured the servlets in a way such that they each handle related actions (so, one servlet may be responsible for all actions relating to setting up a user's account, while another may be used for user correspondance). Currently I have an "action" parameter attached to all query strings (for GETs), and request bodies (for POSTS), and use that in order to determine what action to take in these "related action" servlets.
In other words, my code is structured somewhat like this:
protected void doGet(HttpServletRequest request, HttpServletResponse response)
{
String action = request.getParameter("action");
if(action.equals("login"))
{
.....
}
else if(action.equals("createAccount"))
{
....
}
else if(action.equals("changePassword"))
{
....
}
..........
}
I'm relatively early in the development process, and as of now, I don't find any maintainability issues coming from this design. As per MVC, all the servlets do is call the methods of my utility classes; no actual work is done in them except for sending the responses back to the client. But by browsing SO, I'm coming across the sentiment that even moderately-sized (~10 or less "elses") if-else statements are code-smell and suggest the user isn't doing things the "OOP way".
Is there a better way to filter the types of requests coming in to my servlets? I'd like to be able to improve the maintainability of my app, but unwilling to implement OOP features just because they're OOP (similar to how people despise purists who insist on rigid encapsulation, to the point where they have 24 one-line getters/setters).