File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes javax.servlet.jsp.JspException: Failed to obtain specified collection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "javax.servlet.jsp.JspException: Failed to obtain specified collection" Watch "javax.servlet.jsp.JspException: Failed to obtain specified collection" New topic
Author

javax.servlet.jsp.JspException: Failed to obtain specified collection

Neeraj Vij
Ranch Hand

Joined: Nov 25, 2003
Posts: 315
Hi,

I get the following exception when I don't enter a required field in the form and submit the form.




There are several fields on the jsp screen{textbox, check box, select box}

its unable to populate/retain the values of the select box. it's able to retain the value of other controls on the jsp screen.

Kindly provide some inputs.

Thanks
Neeraj.
Er. Rohit Sharma
Greenhorn

Joined: Dec 11, 2008
Posts: 16
Hi Neeraj,
Can you please tell which tag are you using html:select or htmlptionsCollection?
Did your bean hold the getter and setters for the collection ?
Struts may require an indexed getter method for for your collection. Adding that to your form may allow the select/optionsCollection tag to work correctly
Neeraj Vij
Ranch Hand

Joined: Nov 25, 2003
Posts: 315
we are using and we do have proper setter and getters for the LIST.

can you please guide by providing some sample code for indexed getters/setters ?

thanks
Neeraj>
Er. Rohit Sharma
Greenhorn

Joined: Dec 11, 2008
Posts: 16
Neeraj could you please provide me the code you are working.
Are your collection values are coming from database? Please also check if the bean is present in any scope in jsp.
java mohamed
Greenhorn

Joined: Dec 22, 2010
Posts: 9
i am geeting same issue ... my code is http://www.coderanch.com/t/523670/Struts/Dynamic-drop-down-struts
please give solution...
Guy Belpa
Ranch Hand

Joined: Nov 21, 2004
Posts: 41

Make sure this action forwards to the JSP, and then call the URL for the action (/myaction.do) rather than calling the JSP directly (/mypage.jsp).
... hope this will help other who came to this post thru search
Ricardo Martinez
Greenhorn

Joined: May 15, 2013
Posts: 1
Hello Everyone!


I have had come across this very error and Found the solution that wasn't that obvious and could help as a hint

in my case the optionsCollection could not be found because the <html:form >name was Identical to the InputForm.java with the List, so the options where searched in the wrong place, in this case just following the name convention for Java solved the problem

I hope this could serve as a Hint!


Regards fellow programmers!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: javax.servlet.jsp.JspException: Failed to obtain specified collection
 
Similar Threads
In struts <html:select > optionCollections facing problem
html:optionsCollection from a DynaActionForm
Combo box building
Problem With OptionsCollection Tag
Problem setting form property in action