This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have two pages page1.jsp and page 2.jsp each with managed beans called page1 and page2 respectively in the request scope as shown below
page1 has a selectOneMenu. I also have a command button on page1 which goes to page2. Page2�s purpose is to collect information to add a selectItem to the selectOneMenu on page1.
Partial code shown below, values hardcoded for clarity. The idea here is to save the contents on page1 in some session scoped object, in the page2 action method create a fresh page1bean, update it with the original values, then redisplay page1 with the newly updated values
When I am returned to page1.jsp I see the selectOneMenu list has been updated and everything looks fine. The problem occurs when I then hit the submit button on the redisplayed page1. The item I added disappears from the list.
What�s happening here?
The only happens with the selectOnemenu component. Other inputText components work fine. [ May 12, 2005: Message edited by: Gregg Bolinger ]
What I do it change from the request scope to session scope. If the managed bean is used across multiple pages this is the way I have seen it done and works for me. I normally add a reinit() method to call when I am done with the bean since it remains with the session.
Joined: Mar 11, 2002
Session scope for page1 would work. But can anyone still explain the behaviour as mentioned before.
I'd love to test our your problem however I don't feel like creating the entire app from scratch. If you could provide me with your page1.jsp, page2.jsp and appropriate backing bean(s) I can then plugin some static values for the dropdown(s) and see what the problem is.