谢谢
最好能给具体例子
最好能给具体例子
解决方案 »
- 如何用MyEclipse打开一个Java Web工程 (具体步骤)
- SSH整合问题,项目已在线上,提供帐号请高手帮忙调试。
- session莫名丢失,会是啥原因啊,如何调试
- 简单hibernate方法问题
- js调用外部css
- flex结合java连接数据库
- 忽求此方案 在JCreator 3.50 Pro 中如何配制与Tomcat5.0+SQLServlet2000+Window2003)做开发
- 在Eclipse+Tomcat下如何建一个hello. Jsp啊.工程新建成哪种?
- 各位大哥,有人指点我一下sql server吗
- 这样的情况应该如何查询数据库?
- 这段代码有问题吗
- 即将入门的学生,想了解下JAVA,希望大家帮忙~~
<html>
<head>
<title>MyJsp.jsp</title> <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
--> </head>
<body>
<%
HttpSession s = request.getSession();
s.setAttribute("name","test");
%>
得到Session的值是<%=s.getAttribute("name") %>
<br>
</body>
</html>
session.setAttribute("username",username);
session.setAttribute("password",password);
session获取:
username=session.getAttribute("username");
password=session.getAttribute("password");
lz是想要这个吗?
<%HttpSession Session = request.getSession();
String sesStr = (String)Session.getAttribute("aaa");
%>
session.setAttribute("username",username);
session.setAttribute("password",password);
session获取:
username=session.getAttribute("username");
password=session.getAttribute("password");
session.setAttribute('name',Object);
取值用
session.getAttribute('name');
楼主如果还想使用EL的话, 可以这样调用${sessionScope.variable}来获取值.variable为你设定的key值,如上面他们所用的name, username等
HttpSession