Forums Register Login

selectOneMenu

+Pie Number of slices to send: Send
hi all ,
here is my situation !
i have 2 pages Test1.jsp and Test2.jsp

Test1 has a submit button and it populates an arrayList in managed bean and takes me to Test2.jsp. Test2.jsp has one inputText component , selectoneMenu component and a submit button. The inputText component is a required field, so i have the validator for that. My issue is, if i keep the managedbean in session scope everything works fine but if i keep it in request scope and clicks on submit button on Test2.jsp without entering any values in inputText it throws NoSuchElement exception , instaed of showing validation error.

here is my code for reference. Appretiate if someone could expalin why its not working

this code is getting invoked when i click the submit button of Test1.jsp



test2.jsp for populating selectonemenu



"MyClass" is a managed bean. if i keep this is session scope, it works fine but if i keep in request scope.. it throws java.util.NosuchElement exception
when i click submit button on Test2.
hope i am not making much confusions..

Thanks,
Rajeev
+Pie Number of slices to send: Send
Gregg, are you busy ?
+Pie Number of slices to send: Send
Well that is because you have two requests. One for test1 and another for test2. After you get test1 all variables for that request are disposed. So when the request for test2 comes in your bean no longer exists (it existed in the previous request, the one for test1).
+Pie Number of slices to send: Send
Thanks for the reply, Gerardo ...What is the solution for this ? is it mandatory to store managed bean in session scope ? but i dont wanna do that !

Thanks again,
Rajeev
+Pie Number of slices to send: Send
Well just populate the list on test2.jsp and don't use test1.jsp. Ditch it. From what I understand you only populate the selectList on test1, you don't actually use it. Do you? So you can move that initialization to test2.jsp
It's never done THAT before. Explain it to me tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 2952 times.
Similar Threads
Java Script Reference to JSF components
Help - question on selectOneListbox and page reloads
on change combo box not working.
disabled issue for inputtext
JSF Page Navigation on SelectOneMenu change
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 15, 2024 22:03:05.