Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts Users »

problem with html:text bean throwing exception

Gus Heck

2003-11-18

Replies:

So I have been stuck for a day or so on this exception:

org.apache.jasper.JasperException: Cannot find bean org.apache.struts.taglib.html.BEAN in any scope
 at org.apache.jasper.servlet.JspServletWrapper.service (JspServletWrapper.java:254)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile (JspServlet.java:295)
 at org.apache.jasper.servlet.JspServlet.service (JspServlet.java:241)
etc...

caused by:

javax.servlet.ServletException: Cannot find bean org.apache.struts.taglib.html.BEAN in any scope
 at org.apache.jasper.runtime.PageContextImpl.handlePageException (PageContextImpl.java:533)
 at org.apache.jsp.enter_0002dlocation_jsp._jspService(enter_0002dlocation_jsp.java:132)
 at org.apache.jasper.runtime.HttpJspBase.service (HttpJspBase.java:137)

etc...


I think have determined that it happens when attempting to process this tag:

<% System.out.println ("got here");%>
       <td><html:text property="city" maxlength="50" size= "20"/></td>
<% System.out.println ("got here2");%>

(only the first print statement appears in catalina.out)

I am definately able to find the struts-html taglib (as I am already
inside an html:form tag by this point).

I think I really have a situation where html:form can be found but not
html:text for the following reasons:

Here is the jasper generated code:
  67     out.write("<hr>\n\n");
  68     if (_jspx_meth_html_form_0(pageContext))
  69       return;
  70     out.write("\n   ");
  71     out.write("<table border=\"0\">\n     ");
  72     out.write("<tr>\n        ");
  73     out.write("<td>City:");
  74     out.write("</td>\n");
  75  System.out.println ("got here");
  76     out.write("\n        ");
  77     out.write("<td>");
  78     if (_jspx_meth_html_text_0(pageContext))
  79       return;
  80     out.write("</td>\n");
  81  System.out.println ("got here2");
.... snip .....
 127     out.write("</html>\n");
 128    } catch (Throwable t) {
 129     out = _jspx_out;
 130     if (out != null && out.getBufferSize() != 0)
 131       out.clearBuffer();
 132     if (pageContext != null) pageContext.handlePageException(t);
 133    } finally {
 134     if (_jspxFactory != null)
_jspxFactory.releasePageContext(pageContext);
 135    }
.... snip .....
 154   private boolean
_jspx_meth_html_text_0(javax.servlet.jsp.PageContext pageContext)
 155        throws Throwable {
 156    JspWriter out = pageContext.getOut();
 157    /* ---- html:text ---- */
 158    org.apache.struts.taglib.html.TextTag _jspx_th_html_text_0 =
(org.apache.struts.taglib.html.TextTag)
_jspx_tagPool_html_text_size_property_maxlength.get(org.apache.struts.taglib.html.TextTag.class);
 159    _jspx_th_html_text_0.setPageContext(pageContext);
 160    _jspx_th_html_text_0.setParent(null);
 161    _jspx_th_html_text_0.setProperty("city");
 162    _jspx_th_html_text_0.setMaxlength("50");
 163    _jspx_th_html_text_0.setSize("20");
 164    int _jspx_eval_html_text_0 = _jspx_th_html_text_0.doStartTag();
 165    if (_jspx_th_html_text_0.doEndTag() ==
javax.servlet.jsp.tagext.Tag.SKIP_PAGE)
 166     return true;
 167    
_jspx_tagPool_html_text_size_property_maxlength.reuse(_jspx_th_html_text_0);
 168    return false;
 169   }

So I am willing to suppose that out.write() isn't throwing the
exception, which leaves only _jspx_meth_html_text_0(pageContext).
Looking into that method, I see 3 candidtates:
_jspx_tagPool_html_text_size_property_maxlength.get(org.apache.struts.taglib.html.TextTag.class);
_jspx_th_html_text_0.doStartTag();
_jspx_th_html_text_0.doEndTag()
_jspx_tagPool_html_text_size_property_maxlength.reuse(_jspx_th_html_text_0);

The question is why does one of these throw a Servlet exception when
form doesnt? Though the form tag hasn't closed yet so it could still be
the form tag, when I misname the taglibrary in the JSP I get a different
error.

I am using Struts 1.1 (downloaded a couple days ago) in Tomcat 4.1.27
with Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
on a (redhat 9) linux platform. After spending hours tweaking my
settings nothing I do seems to effect it and I am begining to suspect a
bug, but I find it extremely hard to beleive that there would be a bug
relating to html:text since it is one of the most used tags. Can any1
help me out here?

-Gus



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@(protected)
For additional commands, e-mail: struts-user-help@(protected)



©2008 junlu.com - Jax Systems, LLC, U.S.A.