Discussions

Web tier: servlets, JSP, Web frameworks: problem with html:select in struts

  1. problem with html:select in struts (1 messages)

    Hi! I am getting following error exception javax.servlet.ServletException: Failed to obtain specified collection org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758) org.apache.jsp.pages.codetableoverview_jsp._jspService(codetableoverview_jsp.java:84) 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) root cause javax.servlet.jsp.JspException: Failed to obtain specified collection org.apache.struts.taglib.html.OptionsCollectionTag.doStartTag(OptionsCollectionTag.java:222) org.apache.jsp.pages.codetableoverview_jsp._jspx_meth_html_optionsCollection_0(codetableoverview_jsp.java:285) org.apache.jsp.pages.codetableoverview_jsp._jspx_meth_html_select_0(codetableoverview_jsp.java:258) org.apache.jsp.pages.codetableoverview_jsp._jspx_meth_html_form_0(codetableoverview_jsp.java:152) org.apache.jsp.pages.codetableoverview_jsp._jspx_meth_html_html_0(codetableoverview_jsp.java:107) org.apache.jsp.pages.codetableoverview_jsp._jspService(codetableoverview_jsp.java:77) 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) jsp code : Action code : Vector entries = new Vector(); entries.add(new LabelValueBean("--", "--")); entries.add(new LabelValueBean("TTTT", "TTTT")); entries.add(new LabelValueBean("0010", "0010")); entries.add(new LabelValueBean("0011", "0011")); entries.add(new LabelValueBean("0012", "0012")); newForm.setBuIds(entries); newForm.setBuid("--"); Please help me in sloving the above problem
  2. I normally find using the standard JSTL tags to do these sort of things better. Do you have to use html:select tags in your jsp? If not you could try the following: Place your collection in either the request or session scope. So modify your action to the following: List valueHolder = new ArrayList(); valueHolder.add("TTTT"); valueHolder.add("0010"); valueHolder.add("0011"); valueHolder.add("0012"); session.setAttribute("valueHolder", valueHolder); In the jsp Not sure if this will help.