simplifying the code of servlets