Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet vs JSP as controller

 
Emmanuel Bellas
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If JSP can do anything that a Servlet can do, why not use a single JSP (e.g index.jsp) as the controller to do everything in pretty much the same way as a servlet would (use the RequestDispatcher, access beans and so on)?
Our index.jsp would not need to display anything, so display and processing could be separated sufficiently, could it not?
 
deepak kukreja
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Yes you can use jsp as a controller, which do not contain ne presentation logic.
Just think of a person who knows writing html code.
How could that person write java code......
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Basicly a JSP is nothing else then a Servlet. The only difference is that it is especiall for presentation purpose. So you can use a JSP but you shouldn't.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic