Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Incomplete
-
1.2.4
-
None
-
None
-
Operating System: Windows XP
Platform: PC
-
32861
Description
I having been trying to convert existing pages from extending ActionForm to
DynaActionForm so that I don’t have to provide the set and get. I am having
problems with the optionsCollection trying to get the iterator. The correct
values are being obtained from the database and store via the LabelValueBean
class. The getIterator method in OptionsCollectionTag should have a
Collection, but it throw exception at line 351. Not sure, what is wrong. Thanks
for you help.
Greg
My configuration is as follows:
<form-bean name="SiteEditorForm" type="com.wsa.core.view.SiteEditorForm">
<form-property name="site" type="java.lang.String"/>
<form-property name="arraylist"
type="com.blacklake.business.db.Site"/>
<form-property name="sitename" type="java.lang.String"
initial=""/>
<form-property name="sitedesc" type="java.lang.String"
initial=""/>
</form-bean>
Partial listing of Site class that I am using:
/**************************************************************************
*
**************************************************************************/
public static Collection getArraylist() {
Collection sitecollection = new ArrayList();
DatabaseConnection conn = null;
String emessage = "";
tbSite dbsitelist = null;
tbSite dbsite = null;
try {
// Initialize the database and tbAddress class.
conn = new DatabaseConnection( "development" );
dbsitelist = new tbSite( conn.getConnection(), "default" );
// Get the list from the database.
sitecollection.add( new LabelValueBean( "-add-","0") );
for( Iterator e=dbsitelist.searchAndRetrieveList().iterator();
e.hasNext(); )
//for
}//try
catch( Exception e )
//catch
finally
//finally
return( sitecollection );
} // getArraylist
/**************************************************************************
*
{ ArrayList sites = (ArrayList)Site.getArraylist(); return( sites.toString() ); }
**************************************************************************/
public String toString()// toString
/**************************************************************************
*
{ ArrayList sites = (ArrayList)Site.getArraylist(); return( sites.iterator() ); //Vector sites = Site.getSiteOptions(); //return( sites.iterator() ); }
**************************************************************************/
public Iterator iterator()// toString
Reported exception:
javax.servlet.ServletException: Cannot create iterator for [LabelValueBean[--
add--, 0], LabelValueBean[development, 1], LabelValueBean[test, 2],
LabelValueBean[production, 3]]
org.apache.jasper.runtime.PageContextImpl.doHandlePageException
(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException
(PageContextImpl.java:758)
org.apache.jsp.wsa.siteEditor_jsp._jspService(siteEditor_jsp.java:140)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service
(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter
(MonitorFilter.java:362)
root cause
javax.servlet.jsp.JspException: Cannot create iterator for [LabelValueBean[--
add--, 0], LabelValueBean[development, 1], LabelValueBean[test, 2],
LabelValueBean[production, 3]]
org.apache.struts.taglib.html.OptionsCollectionTag.getIterator
(OptionsCollectionTag.java:351)
org.apache.struts.taglib.html.OptionsCollectionTag.doStartTag
(OptionsCollectionTag.java:185)
org.apache.jsp.wsa.siteEditor_jsp._jspx_meth_html_optionsCollection_0
(siteEditor_jsp.java:386)
org.apache.jsp.wsa.siteEditor_jsp._jspx_meth_html_select_0
(siteEditor_jsp.java:358)
org.apache.jsp.wsa.siteEditor_jsp._jspx_meth_html_form_0
(siteEditor_jsp.java:257)
org.apache.jsp.wsa.siteEditor_jsp._jspService(siteEditor_jsp.java:101)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service
(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter
(MonitorFilter.java:362)
note The full stack trace of the root cause is available in the Apache
Tomcat/5.0.28 logs.