aspose file tools*
The moose likes Struts and the fly likes cannot find bean exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "cannot find bean exception" Watch "cannot find bean exception" New topic
Author

cannot find bean exception

Mehul Mistry
Ranch Hand

Joined: Feb 10, 2006
Posts: 43
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

Joined: Feb 15, 2005
Posts: 4864
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


  • Merrill
    Consultant, Sima Solutions
    Mehul Mistry
    Ranch Hand

    Joined: Feb 10, 2006
    Posts: 43
    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

    Joined: Feb 15, 2005
    Posts: 4864
    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.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: cannot find bean exception