在控制层和业务层处于不同项目中时, 如何让业务层的java类调用SESSION里的信息
高洛峰
高洛峰 2017-04-17 17:48:36
0
5
234

想在业务层所处的项目里面, 创建一个共通工具类来返回SESSION里保存的用户信息
可以实现吗?

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(5)
PHPzhong

Just write a static method and pass HttpRequest into it

迷茫

Or insert the session object into the method of the tool class.

PHPzhong

You just need to pass httpRequest in.

伊谢尔伦

request.getSession

Ty80

Session is something in the Controller layer and should not be passed to the Service and Dao layers. You should extract the user information at the Controller layer and save it in the cache, and then the Service layer obtains the user information through userKey.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template