This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Model Attribute not present in destintation JSP

 
Mike London
Ranch Hand
Posts: 1192
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've got a simple Spring MVC application that isn't quite working.

I build up a list of elements in the controller class like this:



In the outPutList.jsp referenced above by the return statement, however, I do NOT get any list items printed out.

Here's that JSP's body section:



-----

All that prints is: "Listing of Items from Controller". The "theList" list doesn't appear to be there when looking at this JSP in the debugger.

I thought Spring would automatically put this "theList" variable into the JSP's session so I could get at it.

Anybody see anything wrong here?

The strange thing is that the Controller class does run and creates the list and Spring does transfer control to the JSP.

It's just that the JSP isn't getting the list to print out.

Thanks in advance for any help or suggestions.

mike
 
Mike London
Ranch Hand
Posts: 1192
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This issue is resolved.

The only twp minor changes I had to make was the following in the Controller class:

public String createList(final Model model)

.
.
.

model.addAttribute("theList", userList);

---

now it works!

mike
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic