• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Model Attribute not present in destintation JSP

 
Bartender
Posts: 1757
17
  • 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
Bartender
Posts: 1757
17
  • 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
 
CAUTION! Do not touch the blades on your neck propeller while they are active. Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic