0、文档UTF-8设置 打开Eclisps软件时整体设置--属性; 项目属性设置; request.setCharacterEncoding="UTF-8";; response.setCharacterEncoding="UTF-8"; 1、JSP基本结构:java程序段、声明、输出表达式 <% java程序段 %> <%! 声明 %> <%= %>相当于out.print() out.println()和out.print()效果是一样的。如果要换行</br> 2、JSP注释: <!-- HTML注释 --> //java语句注释 /* java程序段注释...*/ <%-- jsp注释 --%> 3、JSP指令: <%@ page language="java" contentType="text/html;charset=utf-8" pageEncoding="utf-8" %> <%@ page errorPage="..." iserrorPage="true" %> <%@ page import="..." %> <%@ include file="..." %> 动作指令: <jsp:include page="..."/> <jsp:include page="..."> <jsp:param name="..." value="..."/> <jsp:param name="..." value="..."/> </jsp:include> <jsp:forward page="..."> <jsp:param name="..." value="..." /> <jsp:param name="..." value="..." /> <jsp:forward> 跳转方式: <a href="...?param=...¶m1=...&..."> 重定向:(两次请求,地址栏看的到变化,数据丢失) response.sendRedirect("相对路径"); 请求转发:(一次请求,地址栏看不到改变,数据不丢失,可以getParameter数据,也可以getAttribute数据) request.getRequestDispatcher("相对路径").forward(request,response); 4、快速查资料的网站:www.runoob.com 第4章重点记忆归纳: 1、深刻理解内置对象,以及重点方法及存储范围 2、Request Request.setCharacterEncoding=“UTF-8”; String request.getParameter(String name); String[] request.getParameterValue(String name); RequestDispatcher request.getRequestDispatcher(String path); request.getRequestDispatcher.forward(request,response); Public void setAttribute(string name,object ); Public object getAttribute(string name); Public void removeAttribute(string name); 3、response response.setHeader("refresh","2"); response.setHeader("refresh","3;URL=hello.jsp") ; response.sendRedirect(String location) ; response.addCookie(Coolie cookie) ; 第5章重点记忆归纳: 4、cookie Public Cookie(string name,string value) Public string getName() Public string getValue() Public void setMaxAge(int expiry) Public void addCookie(Cookie cookie) Public Cookie[] getCookies() 5、session public String getId() public boolean isNew() public void setMaxInactiveInterval(int interval) public int getMaxInactiveInterval() public long getCreationTime() public long getLastAccessedTime() public void setAttribute(String name, Object value) public Object getAttribute(String name) public void removeAttribute(String name) public void invalidate() 第3章重点记忆归纳: 1、深刻理解servlet程序的含义、生存周期、部署及调用。 2、<!-- 配置Servlet --> <servlet> <servlet-name>xxx</servlet-name> <servlet-class>xxx.xxx.xxx</servlet-class> </servlet> <!-- 配置Servlet映射路径 --> <servlet-mapping> <servlet-name>xxx</servlet-name> <url-pattern>/xxx</url-pattern> </servlet-mapping>