tomcat配置域名后session取不到的问题

初墨先生 2015-09-15 09:57:31
验证码生成后放到session中,如果使用Localhost访问是可以取到的,但如果配置了域名,后台去session中的验证码就取不到
HttpServletRequest request=ServletActionContext.getRequest();
HttpSession session=request.getSession();
String check=(String) session.getAttribute("checkcode");
这样取到的check是null
tomcat里域名这样配置的
<Host name="域名" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="" docBase="项目名称" debug="0" reloadable="true" crossContext="true"/>
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->

<!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />

</Host>
如果使用Localhost访问是没有问题的,所以我觉得程序代码是没有问题的
...全文
501 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
懒懒程序员 2015-09-28
  • 打赏
  • 举报
回复
引用 1 楼 NeVer_MoEe 的回复:
来人啊,有大神吗
楼主解决了吗?我也遇到了这样的问题
初墨先生 2015-09-16
  • 打赏
  • 举报
回复
来人啊,有大神吗

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧