3

I am trying to get the session attribute in spring webflow, but it doesn't work. In some controllers I have:

User u = userDao.getUser(userName);
session.setAttribute("sessionUser", u);

In JSP, I can get it, and it works fine:

${sessionScope.sessionUser.getLogin()}

I tried something like this:

<decision-state id="isUserLogged">
    <if test="sessionUser.getLogin() != null" then="startView" else="start" />
</decision-state>

but I get the error:

EL1008E:(pos 0): Field or property 'sessionUser' cannot be found on object of type 'org.springframework.webflow.engine.impl.RequestControlContextImpl'

or

<decision-state id="isUserLogged">
        <if test="${sessionScope.sessionUser.getLogin()}" then="startView" else="start" />
    </decision-state>

error:

 EL1041E:(pos 1): After parsing a valid expression, there is still more data in the expression: 'lcurly({)'

My first question is, how can I get sessionUser in webflow?

I also tried calling the controller method, because in controller method I can get sessionUser, but it doesn't work.

My second question is, how can I call controller method in webflow?

fvrghl
  • 3,642
  • 5
  • 28
  • 36
user2987020
  • 63
  • 1
  • 5

1 Answers1

3

There is no sessionScope in Spring Web Flow. To access an object on the Session, instead you'll need to use the externalContext implicit el-variable something like this:

<if test="externalContext.sessionMap.sessionUser.getLogin() != null" then="startView" else="start" />
Dave Jarvis
  • 30,436
  • 41
  • 178
  • 315
dbreaux
  • 4,982
  • 1
  • 25
  • 64