Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problems accessing ModelAttribute variable in JSP session.  RSS feed

Mike London
Ranch Hand
Posts: 1476
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have a simple

in my Spring 3 MVC controller. I have put an Iterator there to make sure that the userService.loadUsers() is actually populated.

(The loadUsers() method returns a Set.)


Now, in my listUsers.jsp page, I have JSTL like this (to try to set up a combo with a list of user names):


The problem is that the combo is empty -- it never gets populated.

In the debugger, it steps right over the code and doesn't loop as it should.

Therefore, I think I'm missing something basic here.

Isn't the object automatically in the JSP's "session". Do I need to do something special to access it?

Look forward to any suggestions.



guillermo luque
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

First when you mentioned session you meant session scope. HTTPSESSION

I got a problem with sessions in Spring I posted see below

"Thursday, June 23, 2011 7:22:09 PM by guillermo luque Title Session in Spring" Please give your opinon
about my post.
If it is session scope let me tell you.

I was doing some research in sessions

let me ask a question

1.- I assume that you create the session before you run your jsp file and populated it
if you did you used HTTPSESSION or scope-sesion in the controller
if you use HTTPSESSION you need to carry over the session references over you application JSP does not carry over the session automatically when I was writing
app with servelet and jsp I put in all the JSP files

<jsp:useBean id="loginprocessor" class="com.luque.logged.beans.LoginProcessor" scope="application" />
<jsp:useBean id="userinfo" class="com.luque.logged.beans.UserInfo" scope="session" />

The session an application scope were created when the user sign in
But I was trying to use with spring and it did not work.

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!