File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem With OptionsCollection Tag

 
sandeeps kulkarni
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I am new to struts .


i want to add select tag in jsp page .

In Select tag i am adding citynames.

i am using optinscollection tag but i am getting Failed to obtain specified Collection Error.



i went through all posts and tried everything but my problem is not resolved yet.
here i add my code for your reference.

I put collection in request scope and in config file also.

here my html:select tag with optionsCollection.




and Action File


Please let me know solution for this

Your Help will be greatly appriciated Thanks in Advance
 
Sagar Rohankar
Ranch Hand
Posts: 2905
1
Java Spring Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try,


http://struts.apache.org/1.3.10/struts-taglib/tagreference.html#html:optionsCollection
 
sandeeps kulkarni
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sagar,
Thanks for your reply
i tried as you mention.

but now he cant find bean in scope



my struts config xml file





i use request.setAttribute("cityList",cityList);

in my jsp file as <%request.setAttribute("cityList","cityList");%>
after that i got
No getter method for property: "cityNames" of bean: "cityList" error.


then i replace request with session scope in config and action file as

and session.setAttribute("cityList",cityList);

but still not any progress

both are not worked for me.

Your help will be greatly appriciated.


 
Sagar Rohankar
Ranch Hand
Posts: 2905
1
Java Spring Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sandeeps kulkarni wrote:
i use request.setAttribute("cityList",cityList);

in my jsp file as <%request.setAttribute("cityList","cityList");%>
after that i got
No getter method for property: "cityNames" of bean: "cityList" error.

I think the property is "cityName" and NOT "citynames"
Why are you setting request attribute in JSP, there is no need. Also the example I given previously purely based on some assumption and understanding of your code snippet. The given link describe all the attributes for html:optionsCollection tag.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic