Help coderanch get a
new server
by contributing to the fundraiser
  • 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

<html:options> and ActionForms

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need some help with finding the correct syntax for the <html ptions> tag.

Form Bean Code:

public class ActivityForm extends ActionForm {
private Collection departments;
private Collection categories;
...
public Collection getDepartments() {
return departments;
}
public void setDepartments(Collection departments) {
this.departments = departments;
}

JSP Code:
...
<tr>
<th class="required">Department:</th>
<td class="input">
<html:select styleClass="input" alt="Department"
property="departmentId" size="1">
<html ption value="">--------------</html ption>
<html ptions property="departments"
labelProperty="departmentLabel"/>
</html:select>
</td>
</tr>
...

The runtime error I receive is:

javax.servlet.jsp.JspException: No getter method available for property departmentLabel for bean under name null

In fact, the departments Collection is made up of department records and the department records DO have a getter method for departmentLabel.

Can anyone tell me the correct syntax?

Thanks,
 
Sheriff
Posts: 17665
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I highly recommend using the optionsCollection tag instead. The attributes are better named and the intent is much clearer than the options tag. In your case, it would be


[ October 07, 2004: Message edited by: Junilu Lacar ]
 
Matt Connors
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Many Thanks.
 
reply
    Bookmark Topic Watch Topic
  • New Topic