Created
May 3, 2010 15:25
-
-
Save pedromtavares/388191 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | |
this.redirect = new Redirector(request, response); | |
if (request.getParameter("id")==null){ | |
if (request.getMethod().equals("POST")) | |
this.doCreate(request, response); | |
else | |
if (request.getParameter("method")!=null) | |
this.doNew(request, response); | |
else | |
this.doIndex(request, response); | |
} | |
else{ | |
this.resource= manager.find(this.resource.getClass(), Integer.parseInt(request.getParameter("id"))); | |
if (this.resource == null) { | |
this.redirect.to(getServletName(), "Recurso não encontrado."); | |
return; | |
} | |
if (request.getMethod().equals("POST")){ | |
this.doUpdate(request, response); | |
} | |
else{ | |
if (request.getParameter("method")!=null){ | |
String method = request.getParameter("method"); | |
if (method.equals("edit")) | |
this.doEdit(request, response); | |
if (method.equals("delete")) | |
this.doDestroy(request, response); | |
} | |
else | |
this.doShow(request, response); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment