Win a copy of Terraform in Action this week in the Cloud forum!
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Model Attribute not present in destintation JSP

 
Bartender
Posts: 1832
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 1832
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic