File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Servlet vs JSP as controller Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet vs JSP as controller" Watch "Servlet vs JSP as controller" New topic

Servlet vs JSP as controller

Emmanuel Bellas

Joined: Aug 01, 2001
Posts: 5
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

Joined: Aug 13, 2001
Posts: 54
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......

Deepak<br />SCJP
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
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.
I agree. Here's the link:
subject: Servlet vs JSP as controller
It's not a secret anymore!