Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

bean request scope in jsf

  Asked By: Gin    Date: Jul 02    Category: Java    Views: 1589

I have problem with bean request scope.
I have a JSF page with its backing bean on request scope.

I have a customer page that show a selected customer information such
addrsses and invoices.
I want to add a new address to customer address list.after adding a
address when I press F5 (refresh the page),the added address will add

I use <saveSate> tag to save my bean property ( selected customer
Information ) .

how can i prevent of this?



3 Answers Found

Answer #1    Answered By: Vicki Fields     Answered On: Jul 02

What if you redirect the page  to another page say, info page, rather than remaining in the same page

Answer #2    Answered By: Isra Demir     Answered On: Jul 02

you can see this weblog to solv your problem  :


Answer #3    Answered By: Abrianna Rossi     Answered On: Jul 02

When you press  on F5 a new request  is generated by the client and sent to server. Which is known as duplicated post.
So the the server must now that this is a regenerated request. Some frameworks like struts has some solutions for this. see: www.learntechnology.net/.../struts_token.jsp
Back to JSF:
If  jsf  does not support this. You must do it by your self. You must make a hidden form value, an re-read it at your server an make sure that this is not duplicated.

A guide commented this too which may be help full (raibledesigns.com/.../how_does_your_mvc_framework):
In JSF, you can add  a <redirect/> element to any navigation rule defined in jsf-config.xml to force JSF to perform a redirect instead of a forward after having completed an action. However, in Sun's Reference Implementation URL rewriting (which is being used automatically to transfer session information  if cookies are turned off) doesn't work with redirects. This results in losing the user session when redirecting if cookies are turned off in the user's browser. I haven't found a way around that yet.

Didn't find what you were looking for? Find more on bean request scope in jsf Or get search suggestion and latest updates.