aspose file tools*
The moose likes JSF and the fly likes Reinit all bean variables on page load Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Reinit all bean variables on page load" Watch "Reinit all bean variables on page load" New topic
Author

Reinit all bean variables on page load

Herve Dibot
Greenhorn

Joined: Jun 27, 2012
Posts: 3
Hello,

I have a JSP application and i'm facing issues about beans. On a page i have drop down lists, filled "on page loads " thanks to bean, but if i leave the page, visit another page of my website, and then come back to the first page, drop down lists are still focused on the selected values before i leave.
Same for a simple "for each" which add table rows after submitting a form, if I leave the page, and come back, the table is still there with previous values...

I would like to reinit the page like the very first time I come.

Thank you for your help, and sorry for my english. Hope it was clear
Regards
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61426
    
  67

Welcome to the Ranch.

We'll need more information on how the beans are being used during the loading of the page. It sounds like you are trying to do too much work in the JSP that should be handled by the page controller.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Herve Dibot
Greenhorn

Joined: Jun 27, 2012
Posts: 3
Here is an example of a DDL in mypage.jsp



I though about stateful/stateless ? but how making my bean stateless ?
Herve Dibot
Greenhorn

Joined: Jun 27, 2012
Posts: 3
Solved ! I change the scope of my bean from Session to Request and that did the trick.




Thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61426
    
  67

That's JSF markup. Please be sure to ask JSF questions in the JSF forum. I have moved this post there for you.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Reinit all bean variables on page load