当前位置: 代码迷 >> Java Web开发 >> 求帮助JSF有关问题:org.apache.jasper.JasperException: java.lang.NullPointerException
  详细解决方案

求帮助JSF有关问题:org.apache.jasper.JasperException: java.lang.NullPointerException

热度:4669   发布时间:2013-02-25 21:21:45.0
求帮助JSF问题:org.apache.jasper.JasperException: java.lang.NullPointerException
我现在在学习JSF,我试着做了一个HelloWorld,最简单的那种 
运行出错 
如下: 
type Exception report 

message 

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

exception 

org.apache.jasper.JasperException: java.lang.NullPointerException 
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522) 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:356) 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337) 
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) 
javax.servlet.http.HttpServlet.service(HttpServlet.java:803) 
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322) 
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:142) 
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.NullPointerException 
org.apache.jsp.pages.index_jsp._jspInit(index_jsp.java:31) 
org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:52) 
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:159) 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329) 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337) 
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) 
javax.servlet.http.HttpServlet.service(HttpServlet.java:803) 
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322) 
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:142) 
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) 
问题补充:这是我的index页面 
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
<title>第一个JSP </title> 
</head> 
<body> 
<f:view> 
<h:form> 
<h3>请输入名字: </h3> 
名称: <h:inputText value="#{user.name}"> </h:inputText> 
<h:commandButton value="确定" action="login"> </h:commandButton> 
</h:form> 
</f:view> 
</body> 
</html> 
这是我的faces-config配置文件: 
<faces-config> 
  <navigation-rule> 
  <from-view-id>/pages/index.jsp </from-view-id> 
  <navigation-case> 
  <from-outcome>login </from-outcome> 
  <to-view-id>/pages/welcome.jsp </to-view-id> 
  </navigation-case> 
  </navigation-rule> 
  <managed-bean> 
  <managed-bean-name>user </managed-bean-name> 
  <managed-bean-class> 
  cn.javass.faces.UserBean 
  </managed-bean-class> 
  <managed-bean-scope>session </managed-bean-scope> 
  相关解决方案
本站暂不开放注册!
内测阶段只得通过邀请码进行注册!
 
  • 最近登录:Fri Jul 20 09:20:57 CST 2018
  • 最近登录:Fri Jul 20 09:20:57 CST 2018
  • 最近登录:Fri Jul 20 09:20:57 CST 2018
  • 最近登录:Fri Jul 20 09:20:57 CST 2018
  • 最近登录:Fri Jul 20 09:20:57 CST 2018