jQuery in Action, 3rd edition
The moose likes Other Application Frameworks and the fly likes More Spring(MVC) Dumbness Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "More Spring(MVC) Dumbness" Watch "More Spring(MVC) Dumbness" New topic

More Spring(MVC) Dumbness

Gavin Tranter
Ranch Hand

Joined: Jan 01, 2007
Posts: 333
Hello everybody.
I am building an application (slowy), the first page has a list of items, when you click on an item it goes to the second page to a details of that item.

I have a Spring Form (SimpleFormController) for the details page, it has its requried backing object, and displays the details quite nicely.

However I would like the details page to also display the list of items. Now I have tried this using the views model like so:

The only problem is, that once this code is in place, the formbacking object no long displays the item details.

JSP looks like:

<div id="left"> is basicly lifted from the item list page, and isnt part of the form, I dont think it should be part of the form either.

So what am I doing wrong? I think it is because I am creating a model, that overwrites the model created by Object formBackingObject(HttpServletRequest request), but I cant see another mothed that would allow me to do what I wish, which is to add an object to the model without destorying the formbacking part of teh controller.

Is there a good/recommanded/"bible" book on creating Spring MVC applications?

Valentin Tanase
Ranch Hand

Joined: Feb 17, 2005
Posts: 704
Hi Gavin,

First and foremost please make sure that you don't have a typo within your jsp:

Nevertheless if your __itemModel__ is kind of a __Map__, the code above should definitely work. This because you�re using JSTL, which in turn implements and supports the EL (expression language).
Another elegant solution that you could use as well is to override the __referenceData__ method. This will return a map of beans (name-value pairs), which will be bounded to your page within the page context.


I think, therefore I exist -- Rene Descartes
Gavin Tranter
Ranch Hand

Joined: Jan 01, 2007
Posts: 333
Thanks for the reply.
ah sorry about that, I was "cleaning" the code, describing the problem in generic terms rather then in terms of my application.

Thanks for the advice too, it works like a charm
What is annoying me is, i tried

While waiting for a reply, and couldnt get it to work. just get some error which seemed the data i was trying to put in the model wasnt being put in the model. most annoying, perhaps it was down to operas cache, which is a pain when it comes to CSS.

But it works now,
Thank you
Valentin Tanase
Ranch Hand

Joined: Feb 17, 2005
Posts: 704
You're very welcome Gavin , I'm glad I could help.
I agree. Here's the link: http://aspose.com/file-tools
subject: More Spring(MVC) Dumbness
It's not a secret anymore!