我正在尝试获取spring webflow中的session属性,但它不起作用。在一些控制器中,我有:
User u = userDao.getUser(userName);
session.setAttribute("sessionUser", u);在JSP中,我可以获得它,并且它工作得很好:
${sessionScope.sessionUser.getLogin()}我尝试了这样的东西:
<decision-state id="isUserLogged">
<if test="sessionUser.getLogin() != null" then="startView" else="start" />
</decision-state>但是我得到了一个错误:
EL1008E:(pos 0): Field or property 'sessionUser' cannot be found on object of type 'org.springframework.webflow.engine.impl.RequestControlContextImpl'或
<decision-state id="isUserLogged">
<if test="${sessionScope.sessionUser.getLogin()}" then="startView" else="start" />
</decision-state>错误:
EL1041E:(pos 1): After parsing a valid expression, there is still more data in the expression: 'lcurly({)'我的第一个问题是,如何在webflow中获取sessionUser?
我还尝试调用控制器方法,因为在控制器方法中我可以获得sessionUser,但它不起作用。
我的第二个问题是,如何在webflow中调用控制器方法?
发布于 2013-11-20 07:10:44
Spring Web Flow中没有sessionScope。要访问会话中的对象,您需要使用externalContext隐式el变量,如下所示:
<if test="externalContext.sessionMap.sessionUser.getLogin() != null" then="startView" else="start" />https://stackoverflow.com/questions/19950591
复制相似问题