jsp 3指令 7动作 9对象

指令 7动作 9对象


3指令

page

include

taglib


7动作

include

forward

useBean

setProperty

getProperty

parm

pugin


9对象

application javax.servlet.ServletContext

getAttribute

serAttribute

getInitParameter

session javax.servlet.http.HttpSession

getAttribute

serAttribute

config javax.servlet.ServletConfig

getInitParameters

getInitParameter

page javax.servlet.Servlet本身
pageContext javax.servlet.jsp.PageContext

getServletContext

getServletConfig

getSession

getOut

request javax.servlet.http.HttpServletRequest

getAttribute

serAttribute

getParameter

getParameterMap

getParameterNames

getParameterValues

setCharactorEncoding

getCookies

response javax.servlet.http.HttpServletResponse

sendRedirect

getOutputStream

setCookie

out javax.servlet.jsp,JspWriter
exception Throwable

getMessage

getStrackTrace


往往在servlet里这样得到:

HttpServletRequest HttpServletResponse 为参数

先用某种方法得到pageContext

然后

pageContext.getServletConfig

pageContext.getServletContext (或者可以servletConfig.getServletContext())

pageContext.getSession 

pageContext.getOut


=======================================

另外

1 web.xml下配置<context-param>,可以让context读到、


2 pageContext.getAttribute(String name,int scope) 可从pageContext.PAGE_SCOPE、 pageContext.SESSION_SCOPE、pageContext.SESSION_SCOPE、pageContext.APPLICATION_SCOPE中读取数据


3 中文字符处理

String raw = request.getParameter()

byte[] b = raw.getBytes("ISO-8859-1")

String name = new String(b,"gb2312")





你可能感兴趣的:(Web,xml,jsp,servlet)