首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Exception >

[Struts]异常:java.lang.NullPointerException,JAVA方向的东西,怎么这么麻烦

2014-01-26 
不知道能不能解决%@ page contentTypetext/htmlcharsetGB2312 languagejava %%@ taglib uriSt

不知道能不能解决
 
 
  <%@ page contentType="text/html;charset=GB2312" language="java" %>
  <%@ taglib uri="Struts-Html" prefix="html" %>
  <%@ taglib uri="Struts-Bean" prefix="bean" %>
  <%@ taglib uri="Struts-Logic" prefix="logic" %>
 
  <html:html locale="true">
  <head>
  <title><bean:message key="hello.jsp.title"/></title>
  <html:base/>
  </head>
  <body>
  <p><h2><bean:message key="hello.jsp.page.heading"/></h2></p>
  <p><html:errors/></p>
  <logic:present name="ch03.hello" scope="request">
  <h2>
  Hello <bean:write name="ch03.hello.HelloForm" property="person" />!
  </h2>
  </logic:present>
  <html:form action="/HelloWorld.do?action=goName" focus="person">
  <bean:message key="hello.jsp.prompt.person"/>
  <html:text property="person" size="16" maxlength="16"/><br>
  <html:submit property="submit" value="submit"/>
  <html:reset/>
  </html:form><br>
  <html:img page="/struts-power.gif" alt="Powered by Struts" />
  </body>
  </html:html>
  异常信息:
  exception
 
  org.apache.jasper.JasperException
  org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370)
  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:810)
  org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
 
 
  root cause
 
  java.lang.NullPointerException
  org.apache.struts.taglib.TagUtils.retrieveMessageResources(TagUtils.java:1219)
  org.apache.struts.taglib.TagUtils.message(TagUtils.java:1082)
  org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:226)
  org.apache.jsp.hello_jsp._jspx_meth_bean_message_0(org.apache.jsp.hello_jsp:173)
  org.apache.jsp.hello_jsp._jspx_meth_html_html_0(org.apache.jsp.hello_jsp:123)
  org.apache.jsp.hello_jsp._jspService(org.apache.jsp.hello_jsp:94)
  org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
  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:810)
  org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
 
 
  note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs.
 
 

------解决方法--------------------------------------------------------
NullPointerException
  是空指针错误,你的某个地方没判断是否为空。
------解决方法--------------------------------------------------------
变量初始化问题,变量为null的问题。
------解决方法--------------------------------------------------------
好像是这里的问题:
  <%@ taglib uri="Struts-Html" prefix="html" %>         

热点排行