日期:2014-05-18  浏览次数:20748 次

初学jsf,自制的标签使用时报错?
访问MyJsf页面出错,错误信息如下:

type   Exception   report

message  

description   The   server   encountered   an   internal   error   ()   that   prevented   it   from   fulfilling   this   request.

exception  

org.apache.jasper.JasperException
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:358)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:147)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)


root   cause  

java.lang.ClassCastException
cn.pj.tags.pjlabelTag.setProperties(pjlabelTag.java:37)
javax.faces.webapp.UIComponentTag.findComponent(UIComponentTag.java:705)
javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:423)
org.apache.jsp.MyJsp_jsp._jspx_meth_pj_mylabeltag_0(MyJsp_jsp.java:85)
org.apache.jsp.MyJsp_jsp._jspService(MyJsp_jsp.java:60)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:147)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)


note   The   full   stack   trace   of   the   root   cause   is   available   in   the   Tomcat   logs.

在下初学者,这个问题查资料,调试,弄了一天,一直搞不定,只好向各位高手请教了!谢谢!

1   开发工具:eclipse+myeclipes+tomcate

2   项目结构如下

myface
--src
  --cn
    --pj
      --tags
          -pjlabelComponent.java
          -pjlabelTag.java
--WebRoot
  --WEB-INF
    --classes
      --...(省略)
    --lib
        -commons-beanutils.jar
        -commons-collections.jar
        -commons-digester.jar
        -commons-logging.jar
        -jsf-api.jar
        -jsf-impl.jar
        -jstl.jar