1

I have a JSF page with a form. When the form is submitted, a backing bean is called. The backing bean creates the entity object, saves it in the database, sends notifications, etc. and then redirects to a confirmation page that shows some data of the created entity.

The problem is this confirmation page does not show the data: the entity object is reseted because the backing bean is ViewScoped.

I could change the bean to SessionScoped, but I don't think is appropiate, plus then I will have to reset the entity manually everytime the form is submitted.

I could also send the entity id to the confirmation page through a GET request and have it pull the entity from the database, but I wonder if there is a better way to do this.

Thank you very much.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
karmapolice
  • 326
  • 2
  • 11
  • can you post some code of xhtml and bean. Also the approach you are following which seems to be ok .. – vinod Dec 07 '15 at 12:44
  • Mark as duplicate: so, as I understand it, I have to create a backing bean for the confirmation page, am I right? – karmapolice Dec 07 '15 at 12:59
  • Nope. Just store it temporarily in request or flash scope and retain them in postconstruct. Whether it's the same or different bean absolutely doesn't matter to the logic. – BalusC Dec 07 '15 at 13:01
  • Ok, thank you. Anyway, I think I'm going with the conditionally rendered design you mention. I think it makes more sense in this case. – karmapolice Dec 07 '15 at 13:11

0 Answers0