• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem With OptionsCollection Tag

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try,


http://struts.apache.org/1.3.10/struts-taglib/tagreference.html#html:optionsCollection
 
sandeeps kulkarni
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic