2013年11月25日 星期一

jsp-parameter setAttribute, getAttribute jsp-request jsp-response


<%
request.setAttribute("name","James");
request.setAttribute("age","30");
request.setAttribute("sex","male");
%>
<jsp:forward page="RequestScopeDemo02.jsp">


RequestScopeDemo02.jsp

<%
String name = (String)request.getAttribute("name");
String age = (String)request.getAttribute("age");
String sex = (String)request.getAttribute("sex");
%>

pageContext
getException()
getout()
getPage()
getRequest()
getResponse()
getServletConfig()
getServletContext()
getSession()
getAttribute(String name, int scope)
getAttributeNameInScope(int scope)
getAttributeScope(String name)
removeAttribute(String name)
removeAttribute(String name, int scope)
setAttribute(String name,Object value, int scope)
findAttribute(String name)


application
getMajorVersion()
getMinorVersion()
getSeverInfo()
getMineType()
getContext()
getRealPath

session
getID
getCreateTime
getLashAccessedTime
getMaxInactiveInterval
invalidate
isNew
setMaxinactiveInterval
getAttribute
setAttribute

response
addCookie(Cookie cookie)
addDateHeader(String name,long date)
addHeader
addIntHeader
setDateHeader
setHeader
setIntHeader
sendError
sendError
setStatus
sendRedirect(URL)

request
request.setCharacterEncoding("utf-8");
String username=request.getParameter("username");
getParameterNames(); return Enumeration
getParameterValues(String name); return []
getParameterMap() ; return Map
getHeader(String name); ## return string
gettheaderName(); ##return enumeration
getIntHeader(String Name); ## return string
getDateHeader(String name);## return long
getCookies(); ## return cookie
getContextPath() ## return string e.g. return /erp
getMethod()## return string
getProtocol()## return string
getQueryString()## return string
getRequestedSessionId();## return string
getRequestURI();## return string
getRemoteAddr();## return string
getRemoteHost();## return string
getRemotePort(); ## return int
getRemoteUser(();  ## return string

沒有留言:

張貼留言