• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Neeraj Vij
Ranch Hand
Posts: 315
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 315
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 41
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic