File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes Bean gets instantiated again in one request Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "Bean gets instantiated again in one request" Watch "Bean gets instantiated again in one request" New topic
Author

Bean gets instantiated again in one request

sanju dharma
Ranch Hand

Joined: Oct 19, 2000
Posts: 45
Hi,
I am new to JSF and going through very simple tutorial right now. I input my name on first page which i display it on next page. But surprisingly, the mapped bean gets destroyed and new bean instance is created in one request. So returned data from the bean on next page is always null. Here is very simple code.

inputname.jsp



greeting.jsp ( just to display name entered on the previous page )

Tak Ng
Greenhorn

Joined: Jun 05, 2007
Posts: 19
Open faces-config.xml and check if you have the option "<redirect/>" in the navigation-rule between these two pages. In the case that "<redirect/>" is present, please comment it and test again.
Gabriel Claramunt
Ranch Hand

Joined: May 26, 2007
Posts: 375
Check also the scope of the bean, if is "request", you'll get a new one each time the page is loaded. If you set the scope to "session", it will keep the values until you finish your session.


Gabriel
Software Surgeon
 
 
subject: Bean gets instantiated again in one request
 
Threads others viewed
Error: Target Unreachable, identifier 'StoreNameBean' resolved to null
JSF beginner's question
t:inputText id="test", how to get its value?
Datatable trying to access non-existent field from Bean
Bean value doubt
developer file tools

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture