Jsp 简单复习-不要太在意细节

1, http://localhost:8080/MyWebApp/HelloWorld.jsp

3, http://localhost:8080/MyWebApp/AccessCounts.jsp   最佳实践 : 尽量不要在Servlet中,设计成员变量
4, http://localhost:8080/MyWebApp/BGColor.jsp?bgColor=red  知识点4 : request.getParameter("bgColor");
		String bgColor = request.getParameter("bgColor");
		boolean hasExplicitColor;
		if (bgColor != null) {
		  hasExplicitColor = true;
		} else {
		  hasExplicitColor = false;
		  bgColor = "WHITE";
		}
		%>
		<BODY BGCOLOR="<%= bgColor %>">
5, <% %> 之中的,运行在服务器端,其他html语句运行在客户端     知识点5 : 注释语句
6, http://localhost:8080/MyWebApp/TestDirective.jsp   知识点6 : 编译指令
    <%@page import="java.util.*" session="false"%>
	<%@page contentType="text/html;charset=gb2312"%>
	<%= new Date() %>
	<%
		out.println("ÄãºÃ!");
	%>
	Jsp 编译指令
     (Directive-page)
7, http://localhost:8080/MyWebApp/TestErr.jsp   知识点7 : 错误转到
	    <%@page errorPage="ErrPage.jsp"%>
		<%
		String s="123Plus";
		int i=Integer.parseInt(s);
		out.println("s=" + s + "  i=" + i);
		%>
   http://localhost:8080/MyWebApp/ErrPage.jsp
        <%-- ********* ErrPage.jsp ********** --%>
		<%@ page contentType="text/html;charset=gb2312" %>
		<%@ page isErrorPage="true" %>
		<HTML>
		<BODY TEXT="red">

		ŽíÎóÐÅÏ¢£º<%= exception.getMessage() %>
		</BODY>
		</HTML>
8, http://localhost:8080/MyWebApp/TestBar.jsp   知识点8 : 静态包含
        <%@page contentType="text/html;charset=gb2312"%>
		<HTML> <!-- *************** TestBar.jsp ***************** -->
		<HEAD>
		<TITLE>TestBar.jsp</TITLE>
		</HEAD>
		<BODY>
		<TABLE WIDTH="100%">
		<TR><TD><%@ include file="TitleBar.jsp" %></TD></TR>
		<TR><TD><% out.println("<P>ÕâÊÇÓû§ÏÔÊŸÇø</P>"); %></TD></TR>
	http://localhost:8080/MyWebApp/TitleBar.jsp
		<%@page contentType="text/html;charset=gb2312"%>
		<TABLE> <!-- ********** TitleBar.jsp ************** -->
		<TR>
		<TD>
		</TD>
		<TD>
		<% out.println("Hi: " + request.getParameter("user"));%>
		<%=new java.util.Date()%>
		</TD>
		</TR>
		</TABLE>
9, http://localhost:8080/MyWebApp/include/include.jsp  知识点9 : 动态包含  (不常用)
   http://localhost:8080/MyWebApp/include/date.jsp
10, http://localhost:8080/MyWebApp/forward/test.jsp    知识点10 : 转向
    http://localhost:8080/MyWebApp/forward/forward.jsp
    http://localhost:8080/MyWebApp/forward/forward1.jsp
    JSP-编程 04 转向 jsp:forward 与 sendRedirect
    http://blog.csdn.net/robbyo/article/details/17758109
   





posted @ 2014-03-16 14:58  小尼人00  阅读(155)  评论(0编辑  收藏  举报