Struts Technology Fundamentation

Servlet.
It contains some important class:
1. HttpServletResponse.
2. HttpServletRequest.
3. HttpSession.
4.ServletContext.
JSP.
1. page
2. request
3. session
4. application
JavaBean.
<jsp:useBean id="testBean" scope="page|request|session|application" class="sample.TestBean"/>
<jsp:getProperty name="testBean" property="count"/>
<jsp:setProperty name="testBean" property="count" value="2"/>
Tag.
jsp tag can simple the development of web project.

The Three Type Relation Amony Web Components.
1. Request Forward. It's based on Servlet. javax.servlet.RequestDispatcher.forward() is one of implementation. <jsp:forward> is another version. (Notice: the jsp file will be precompiled into java file which is a standard servlet)
2.Request Redirect. It's different from the previous type( Request Forward).Redirect to any URL(maybe not in the same application) and Request object is not shared are the two ones of differences. HttpServletResponse.sendRedirect().
3.Include. javax.servlet.RequestDispatcher.include().
RequestDispatcher rd;
rd=request.getRequestDispatcher("/hear.jsp");
rd.include(request,response);
rd=request.getRequestDispatcher("/main.jsp");
rd.include(request,response);
rd=request.getRequestDispatcher("/footer.jsp");
rd.include(request,response);
<%@ include file="head.jsp"%>
<%@ include file="main.jsp"%>
<%@ include file="footer.jsp"%>

43 Things tags: , , , ,


google Tags:

你可能感兴趣的:(struts)