JSP Servlet Relationship

Books and the Internet have many examples of how to use servlets as JSPs. But I would like to know what is the best way to use them, with reasonable architecture.

Should there be a one-to-one relationship between Servlets and JSPs? Perform as ASP.NET Code Behind Pages?

Or is it more like ASP.NET MVC, with one servlet managing multiple actions and forwarding to several views?

This is a question about clean Java EE development. Please do not just offer a different infrastructure.

+5
source share
4 answers

How about this? I did this in one of my school projects:

alt text http://img576.imageshack.us/img576/3064/mvci.jpg

, JSP. , .

+2

Servlets JSP? ASP.NET " "?

. -, , 3 5 , , , MVC- , .

ASP.NET MVC, , ,

- . Java- ASP.NET MVC, , JSF (JavaServer Faces). Java EE, MVC, FacesServlet , Javabean JSP ( ) Facelets . Facelets? , JSF 2.0 JSP Facelets . XHTML.

, , . .

. :

+5

, " " Servlets JSP , .

Servlets , , HTTP REQUEST, (HTML) JSP. ASP.NET "Code-Behind" , CODE-BEHIND - ASPX . AFAIK, "" ASP.NET ASPX.

, , , Servlets + JSP , , , (Struts, JSF ).

+1
source
  • JSP servlets (hidden). Each jsp is converted and compiled as a servlet. Check out your tomcat / work directory for exmaple
  • JSP is a viewing technology, i.e. simplifies the recording of reusable pages.
  • JSP should only be used to display the results that a regular servlet previously calculated, placed inside a request / session, and redirected to the corresponding jsp.
0
source

All Articles