aspose file tools*
The moose likes Struts and the fly likes Problem With OptionsCollection Tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem With OptionsCollection Tag" Watch "Problem With OptionsCollection Tag" New topic
Author

Problem With OptionsCollection Tag

sandeeps kulkarni
Greenhorn

Joined: May 30, 2009
Posts: 8
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

Joined: Feb 19, 2008
Posts: 2902
    
    1

Try,


http://struts.apache.org/1.3.10/struts-taglib/tagreference.html#html:optionsCollection


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
sandeeps kulkarni
Greenhorn

Joined: May 30, 2009
Posts: 8
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

Joined: Feb 19, 2008
Posts: 2902
    
    1

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.
 
jQuery in Action, 2nd edition
 
subject: Problem With OptionsCollection Tag