求救!关于session的问题!!!??? 用session.putValue("User",username);String User = (String)session.getValue("User");试试 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 HttpSession session = request.getSession(true);session.removeAttribute("user");session.setAttribute("user","name"); 楼上的:HttpSession session = request.getSession(true);上面这句编译出现问题,这句应该在servlet中才会用到,在jsp中session是隐藏的已经定义好了,不能重新定义。不是这个原因,不过谢谢你的回答! 楼上的:HttpSession session = request.getSession(true);上面这句编译出现问题,这句应该在servlet中才会用到,在jsp中session是隐藏的已经定义好了,不能重新定义。不是这个原因,不过谢谢你的回答! 我一直是用session.putValue("User",username);String User = (String)session.getValue("User");方法,在weblogic里面能用呀!那我无能为力了 按你的步骤,我怎么能得到SESSION 值啊?session.jsp<html><head><title>Untitled Document</title><meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head><body bgcolor="#FFFFFF" text="#000000"><%@ page contentType="text/html; charset=gb2312" %><%session.setAttribute("name","rocie");response.sendRedirect("rocie.jsp");%></html>rocie.jsp<html><head><title>Untitled Document</title><meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head><body bgcolor="#FFFFFF" text="#000000"><%@ page contentType="text/html;charset=gb2312" %><%out.print(session.getAttribute("name"));%></body></html> 没有问题呀,我用resin,一切正常~~~~ 这是不是跟webserver配置有关呢我看了一些资料,好像就像楼上几位说的一样,可是我光这样的例子就试过不下十次还是不行我还想问,设置session后,不管是从jsp->jsp->htm->jsp等等路径走下去以后,session还可以取得到呢?谢谢! 打开你的cookie或者用urlrewrite <%@ page session="true" %>页首有没有这行语句啊 看你的code应该是忘了在每个jsp的页面的前面加上这句<%@ page session="true" %> 这儿!在浏览器的设置里打开cookie,也就是允许使用cookie!!!就不会出错了。 关于SSH整合的解析映射文件的错误Caused by: org.dom4j.DocumentException 有关RMI的问题,知道的请帮小弟一把,谢谢!! 请教一个servlet启动的问题 在线 ---隐藏域问题!!!急!!!!! ????? jsp登陆界面验证 jsp表单提交时,POST和GET有何具体区别? 使用池连接,有时可以用。时而报错,是怎么回事。。 tomcat 的问题!!!!!!高分 初学JSP,问一个简单的JAVABEAN问题。 请问JSP如何能够执行呀?我是新人! 关于时间的问题
session.removeAttribute("user");
session.setAttribute("user","name");
HttpSession session = request.getSession(true);
上面这句编译出现问题,这句应该在servlet中才会用到,在jsp中session是隐藏的已经定义好了,不能重新定义。
不是这个原因,不过谢谢你的回答!
HttpSession session = request.getSession(true);
上面这句编译出现问题,这句应该在servlet中才会用到,在jsp中session是隐藏的已经定义好了,不能重新定义。
不是这个原因,不过谢谢你的回答!
String User = (String)session.getValue("User");方法,在weblogic里面能用呀!那我无能为力了
session.jsp<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head><body bgcolor="#FFFFFF" text="#000000">
<%@ page contentType="text/html; charset=gb2312" %>
<%
session.setAttribute("name","rocie");
response.sendRedirect("rocie.jsp");
%>
</html>rocie.jsp<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head><body bgcolor="#FFFFFF" text="#000000">
<%@ page contentType="text/html;charset=gb2312" %>
<%
out.print(session.getAttribute("name"));
%>
</body>
</html>
我看了一些资料,好像就像楼上几位
说的一样,可是我光这样的例子就试过不下十次
还是不行
我还想问,设置session后,不管是从jsp->jsp->htm->jsp
等等路径走下去以后,session还可以取得到呢?
谢谢!
或者用urlrewrite
页首有没有这行语句啊
应该是忘了在每个jsp的页面的前面加上这句<%@ page session="true" %>
在浏览器的设置里打开cookie,也就是允许使用cookie!!!就不会出错了。