两个Web应用程序之间共享用户session

Olics 2003-03-06 05:07:33
我现在是这样的,我有两个应用程序,他们都有登录系统,我想让他们使用一个登录系统,并且在这两个应用程序之间共享Session,我在登录成功时需要设置用户信息,这个信息放在Session中,如何设置。现在不可能考虑把两个应用程序放到一起,首先改动较大,其次不是一个人开发,读起来也比较麻烦,如果能共享用户SessionBean,什么问题都解决了。
...全文
69 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
xuetinge 2003-03-17
  • 打赏
  • 举报
回复
server.xml config:
<!-- PersistentManager: Uncomment the section below to test Persistent
Sessions.

saveOnRestart: If true, all active sessions will be saved
to the Store when Catalina is shutdown, regardless of
other settings. All Sessions found in the Store will be
loaded on startup. Sessions past their expiration are
ignored in both cases.
maxActiveSessions: If 0 or greater, having too many active
sessions will result in some being swapped out. minIdleSwap
limits this. -1 means unlimited sessions are allowed.
0 means sessions will almost always be swapped out after
use - this will be noticeably slow for your users.
minIdleSwap: Sessions must be idle for at least this long
(in seconds) before they will be swapped out due to
maxActiveSessions. This avoids thrashing when the site is
highly active. -1 or 0 means there is no minimum - sessions
can be swapped out at any time.
maxIdleSwap: Sessions will be swapped out if idle for this
long (in seconds). If minIdleSwap is higher, then it will
override this. This isn't exact: it is checked periodically.
-1 means sessions won't be swapped out for this reason,
although they may be swapped out for maxActiveSessions.
If set to >= 0, guarantees that all sessions found in the
Store will be loaded on startup.
maxIdleBackup: Sessions will be backed up (saved to the Store,
but left in active memory) if idle for this long (in seconds),
and all sessions found in the Store will be loaded on startup.
If set to -1 sessions will not be backed up, 0 means they
should be backed up shortly after being used.

To clear sessions from the Store, set maxActiveSessions, maxIdleSwap,
and minIdleBackup all to -1, saveOnRestart to false, then restart
Catalina.
-->
<!--
<Manager className="org.apache.catalina.session.PersistentManager"
debug="0"
saveOnRestart="true"
maxActiveSessions="-1"
minIdleSwap="-1"
maxIdleSwap="-1"
maxIdleBackup="-1">
<Store className="org.apache.catalina.session.FileStore"/>
</Manager>
-->
把后面的注释打开,
然后配置一下参数,
我说的这个是TOMCAT的参数配置。
可以共享SESSION的。
zxhong 2003-03-06
  • 打赏
  • 举报
回复
不如用cookie
http://www.csdn.net/develop/Read_Article.asp?Id=9903
bromon 2003-03-06
  • 打赏
  • 举报
回复
你要共享的是session还是sessionBean??
是你乱用名词,还是我水平低??偶读书少,别欺负偶

81,122

社区成员

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

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