在下面学习的代码是一个学习情况,我希望当我运行下面的代码,我可以原样保存到HTTP会话在HttpSession中存放的扩展对象
learning = new Learning(learningContext);
HttpSession webSession = request.getSession();
webSession.setAttribute("learning", learning);
Learning learnTest = webSession.getAttribute("learning");
:
Incompatible types
Learning learnTest = webSession.getAttribute("learning")
required: Learning
found: Object
我可以将非通用对象保存到会话吗?是否有另一种方法来实现这一目标?
您是否尝试过类似的ToString()或浇注的任何变通办法? –