This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSF Browser Refresh

 
Andy Holm
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using the POST redirect to GET code here:
http://balusc.blogspot.com/2007/03/post-redirect-get-pattern.html.

I am able to redirect my POST action to a GET and have a page loaded with URL request parameters. The request parameters are correctly updated in my managed bean thanks to entries in the faces-config file. The problem comes when I reload a page (via the browser refresh button) that shows results from a database query. The query is not re-run as I would like it to be. How do I call code in my backing bean on a browser refresh?
 
Darryl Nortje
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That page you mentioned is not found.

I think you might mean this page.

cheers
Darryl.
 
Andres Quinones
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Andy your Backing Bean in which scope is defined?? As I understan probably is in session scope, so when you refresh your page the data is loaded as it is in the Bean. One solution could be to change it to Request and reload the data from the DB on each submit.

Hope this helps.
 
Andy Holm
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My beans are in request scope. The problem is that on a browser refresh the page does not automatically call my business logic. One way around this I have found is to call my business logic directly in my JSP. However, I don't like this solution because it breaks the model-view-controller pattern.

Are there other options?
 
Andy Holm
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In case anyone was mislead by Darryl, the URL in my original post was correct. The period at the end of the sentence mistakenly got attached to the URL. Again, the URL is http://balusc.blogspot.com/2007/03/post-redirect-get-pattern.html
 
Andy Holm
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone have any suggestions?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic