• 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

s:iterator within s:select

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anyone please let me know how to build list/select box in a jsp with someObj as its options?

Problem:
Say i've a Person object which has Telephone object in it

How do i iterate this and build a select/list box in my jsp? I want to display the items in my select box in the format
Name TN-Extn (Eg) George 17037234444-122

I tried like

Its not displaying any value in it. But its creating entries of 5 in the list box. My Page view source gives


Please let me what is wrong in my code

Thanks



 
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which version of struts you are using.

In struts 1.1 iterate tag using like,
<logic:iterate id="assignedList" name="assignedList" type="package.Person" indexId="i" >
 
Sakthi Priya
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
am using struts 2.1
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should not be using var="assignedList" in the iterator tag: the "var" attribute defines the name of each object of iteration. First try removing the "var" attribute.
 
Sakthi Priya
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No David, Even after removing var attribute the output is same.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The <option> tag definitely won't work; you're trying to use OGNL outside of everything that knows about OGNL. In the property tags the "Telephone" should be lower case, although a coworker of mine discovered that it will actually work anyway--but it's confusing and misleading.

Please post your current code if you're still having issues (in a new message, not by editing the first one).
 
Sakthi Priya
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi David,

I didnt edited any of my content later i submitted at the first time. The code that i posted in my first post is the one that i was using exactly in my prj.

I didnt look into this problem again, as my project requirement is changed.

But still i wanted to try it out, as it may help at some point.
reply
    Bookmark Topic Watch Topic
  • New Topic