aspose file tools*
The moose likes Spring and the fly likes Problems accessing ModelAttribute variable in JSP session. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Problems accessing ModelAttribute variable in JSP session." Watch "Problems accessing ModelAttribute variable in JSP session." New topic
Author

Problems accessing ModelAttribute variable in JSP session.

Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1034
Hello,

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.

Thanks,

mike

guillermo luque
Greenhorn

Joined: Aug 03, 2002
Posts: 10
Hi

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.


gigigigigigigigi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problems accessing ModelAttribute variable in JSP session.
 
Similar Threads
populate combox with list with default selected value
Nested hashmap tags for dynamic pulldowns
jstl c:forEach
how to display values from database in a dropdown box?
problem getting all parameters from multiple select