Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

cannot find bean exception

 
Mehul Mistry
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,
I've just learned Struts framework and trying my hands on some assignments. While developing a from using Struts-html tags i'm gettin an exception as follows....

javax.servlet.ServletException: Cannot find bean: "org.apache.struts.taglib.html.BEAN" in any scope
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
org.apache.jsp.pages.RegisterPatient_jsp._jspService(org.apache.jsp.pages.RegisterPatient_jsp:73)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1062).............
...........
..........
.......


After trying out everything i figured out that its not been able to find the taglib.I removed other components from my form and narrowed down to the following jsp file....

<%@taglib uri="/tags/struts-html" prefix="html" %>

Patient Name : <html:text property="name"/>

The "html:text" tag is giving the exception.If i try with "html:button", it works but not for text or textarea. Can anyone pls guide me where i'm goin wrong.
Thanks.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are a number of possible causes of this problem:

1-You didn't enclose your <html:text> tag with an enclosing <html:form> stanza

2-The action attribute on the <html:form> tag does not match the path attribute of one of the actions defined in struts-config.xml

3-The ActionForm matching the name attribute of your Action mapping does not have a name property.

If you are still unable to figure out the problem, please post:
  • Relevant portions of your struts-config.xml file
  • Your entire JSP
  • Your ActionForm class

  •  
    Mehul Mistry
    Ranch Hand
    Posts: 43
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    hi..
    Thanks for your reponse. I checked all the things you said. But I'm still stucked with it.
    This time the exeption is.....


    javax.servlet.ServletException: Exception creating bean of class org.hospital.ui.formbean.RegisterFormBean: {1}
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
    org.apache.jsp.pages.RegisterPatient_jsp._jspService(org.apache.jsp.pages.RegisterPatient_jsp:77)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1062)
    ..........
    .....
    ..

    My jsp file is...


    -----------------------------------------------------------------


    My Action class is...
    ---------------------------------------------------------------


    ------------------------------------------------------------------

    My forbean class is....


    -----------------------------------------------------------------

    My bean class is.........
    -----------------------------------------------------------------


    ----------------------------------------------------------------

    Relevant parts from struts-config.xml is .....


    -----------------------------------------------------------------------------------

    Can you pls coment on this. I'm sorry if i sound too im-mature.....

    Thanks.
     
    Merrill Higginson
    Ranch Hand
    Posts: 4864
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    This exception is telling you that Struts can't create the form bean for some reason. The most likely explanation is that the class file does not exist. Make sure that ResisterFormBean.class exists in the appropriate subdirectory of WEB-INF/classes.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic