• 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:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Objects are not staying permanently after JSP is reloaded in next time.

 
Ranch Hand
Posts: 165
Tomcat Server Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, on my JSP there is a select box which has some objects pre-populated before the screen is displayed to user for his input. Now what is happending when the user submits the form, it performs server side validations using the Spring Validations and in case some issue is found then redirects to same JSP with the error messages to be displayed on JSP. Now this time the pre-populated objects in my dropdown select box are gone, completely blank. Please tell me what is causing this issue and how to make them permanently available on JSP.

here are my codes:-


I'm setting into model using addAttribute() and on JSP retrieving like this:-


First load of JSP, it is coming and on refresh also it is coming but when a page is submitted or actually processed and comes back then it displays nothing.

Thanks
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have some code here that adds attributes into the model.
This happens on the default render request.

Does it run through this code when processing this page?
Or is that a different render request?

 
Vinod Vijay
Ranch Hand
Posts: 165
Tomcat Server Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stefan Evans wrote:You have some code here that adds attributes into the model.
This happens on the default render request.

Does it run through this code when processing this page?
Or is that a different render request?


Hi Stefan,

Yes! this is default render request method which gets called when my jsp is loaded for first time. And when user submits the form, another method Action request gets called. In that method, it checks server side validations and if something goes incorrect then it redirects to this same default render request method.
 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
most likely you are not getting in that same handler so your model is not getting populated again, set a breakpoint and see. You could also store it as an @SessionAttributes this way it will stay available for you.

See
http://static.springsource.org/spring/docs/3.1.x/spring-framework-reference/html/portlet.html#portlet-ann-sessionattrib

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic