Included below is info from the jsp, form class, and config file. Any
advice? I'm stuck. I've got a fix, but its really
terrible(embarrassing, but it works).
Here's the relevant JSP code(start.jsp):
<html:form action="/export">
<html:select property="customer" size="1">
<html:options property="customers" labelName="value"
labelProperty="key"/>
</html:select>
<P>
<html:submit property="addButton" value="Export"/>
</html:form>
ExportForm(ActionForm):
public Hashtable getCustomers(){
....
Hashtable hash = new Hashtable();
ResultSet rset = statement.executeQuery("select name, id from table");
while(rset.next()){
hash.put(rset.getString("name"), rset.getString("id"));
}
.....
return hash;
}
struts-config.xml:
<form-beans>
<!-- Export Form -->
<form-bean name="exportForm"
type="com.foo.ui.struts.form.ExportForm"/>
</form-beans>
<global-forwards>
<forward name="export" path="/content/start.jsp"/>
</global-forwards>
<action-mappings>
<!-- Export Action -->
<action path="/export" input="/content/start.jsp"
name="exportForm" scope="request"
type="com.foo.ui.struts.action.ExportAction">
<forward name="manager" path="/content/start.jsp"/>
</action>
</action-mappings>
John Raley wrote:
> (Sorry if this duplicates a previous response)
>
> The fact that the bean name is null makes me suspicious:
> 1. Are you using <html:options> within an <html:form> tag?
> 2. Does your action specify a name (in struts-config.xml)?
> Or,
> does your form bean class have a customers property?
>
> Shannon Moschetti wrote:
>
>> 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(WebAppServletContext.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(WebAppServletContext.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)
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>
>
>
>
>