Is this a typo?  If not, it is probably your problem.

>>   <html:select property="customer" size="1">
>>       <html:options property="customers"/ labelName="value"
>> labelProperty="key">
>>   </html:select>

Should be:
<html:select property="customer" size="1">
  <html:options property="customers" labelName="value" labelProperty="key"/>
</html:select>

Backslash denoting end of element in wrong place.

Besides that, I use the 'collections' attribute of html:options, and don't
use labelName.  Example:
<html:select property="typeId">
  <html:options collection="typecollection" property="id"
labelProperty="name"/>
</html:select>

In this case, 'typecollection' is a Collection of objects that have getId()
and getName() methods.  The return of these methods will be used to populate
the drop-down list.  The 'property' attribute of the html:select element
denotes which option to select by default (that is, to add the 'selected'
attribute to).  This is determined by calling the method of the form bean
denoted by the 'property' attribute.  In other words, when the return of
[form_bean].getTypeId() matches [typecollection].getId(), the option would
be 'selected'.

Use case:  in the case that three objects in 'typecollection' had ids of
1,2,3 and names of name1,name2,name3, and the [form_bean].getTypeId()
returns 2, this would be the output:
<select name="typeId"><option value="1">name1</option>
<option value="2" selected>name2</option>
<option value="3">name3</option></select>

    Hope this helps,
        - eric

----- Original Message -----
From: "Shannon Moschetti" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 06, 2001 8:29 AM
Subject: Re: Getting values from ActionForm bean


> Boy, I thought for sure that someone would have a suggestion for me
> concerning this question.  Is more information needed?
>
> Shannon Moschetti wrote:
>
> > Sorry... the error generated from my JSP is as follows, and not the
> > error included in the original message:
> >
> > javax.servlet.jsp.JspException: No getter method available for
> > property customers for bean under name null
> >   at
> >
org.apache.struts.taglib.html.OptionsTag.getIterator(OptionsTag.java:338)
> >   at
> > org.apache.struts.taglib.html.OptionsTag.doEndTag(OptionsTag.java:234)
> >   at
> > jsp_servlet._content._managerstart._jspService(_managerstart.java:337)
> >   at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
> >   at
> >
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:213)
> >
> >   at
> >
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:246)
> >
> >   at
> >
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
ntext.java:1265)
> >
> >   at
> >
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
:1622)
> >
> >   at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
> >   at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
> >
> >
> > Shannon Moschetti wrote:
> >
> >> I'm new to struts and would like to get a handle on a few things.  I
> >> made certain to search the archives for an answer to my current
> >> problem, but was unable to find an answer.  So I post my question here.
> >>
> >> I have an ActionForm in which I added a method that queries a
> >> database and gets a name/id pair and adds them to a hashtable.  On
> >> creation of the form(in the JSP associated with the ActionForm class)
> >> I want to populate a combobox on the form with values from the
> >> hashtable.  Here's what I tried, and the results of the code:
> >>
> >> JSP
> >>   <html:select property="customer" size="1">
> >>       <html:options property="customers"/ labelName="value"
> >> labelProperty="key">
> >>   </html:select>
> >>
> >> ActionForm
> >> public Hashtable getCustomers(){
> >>   // query database, build hashtable
> >>   return hash;
> >> }
> >>
> >> The ActionForm is a request scope bean, as specified in struts-config.
> >> Here's the error I get:
> >> javax.servlet.jsp.JspException: Cannot find bean exportForm in scope
> >> request
> >>   at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:486)
> >>   at
> >> org.apache.struts.taglib.bean.DefineTag.doStartTag(DefineTag.java:200)
> >>   at
> >> jsp_servlet._content._managerstart._jspService(_managerstart.java:297)
> >>   at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
> >>   at
> >>
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:213)
> >>
> >>   at
> >>
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:246)
> >>
> >>   at
> >>
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
ntext.java:1265)
> >>
> >>   at
> >>
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
:1622)
> >>
> >>   at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
> >>   at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
> >>
> >>
> >>
> >
> >
> >
>
>

Reply via email to