-
application
后台:ServletContext a=this.getServletContext(); a.setAttribute("name",Object);
前台:${applicationScope.name};
- Cookie
//使用Cookie
Cookie c=new Cookie("user",admin);
response.addCookie(c);
...
response.sendRedirect("index.jsp");
//读取Cookie
<%
Cookie[] c=request.getCookies();
String user="";
for(int i=0;i<c.length;i++){
if(c[i].getName().equals("user")){
user=c[i].getValue();
}
}
%>
<lable>用户名</label><input type="text" name="uname" value="<%=user%>" />
- JavaBean:封装数据和业务