日期:2014-05-17  浏览次数:20724 次

struts2 中<s:a>标签中诡异的错误
我拷贝一个新页面,内容删除,就剩一个头部,可是访问这个页面时确保错了,错误原因就是因为<s:a>标签,这个标签在其他页面用过很多次,不是标签库没有导入的问题。先看一下配置文件
<!-- BbsAction配置 -->
<action name="bbs_*" class="bbsAction" method="{1}">
<result name="list">WEB-INF/jsp/bbsaction/list.jsp</result>
<result name="show">WEB-INF/jsp/bbsaction/show.jsp</result>
</action>
<!-- replyAction配置 -->
<action name="reply_*" class="replyAction" method="{1}">
<result name="show">WEB-INF/jsp/replyaction/show.jsp</result>
</action>
下面那个是以上面那个为模板拷贝的,页面也是以上面那个为模板拷贝的,下面是页面代码:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<html>
<head>
<title></title>
<%@ include file="/WEB-INF/jsp/public/public.jspf" %>
<link rel="stylesheet" type="text/css" href="./style/css/forum.css" />
</head>

<body>
<div class="center">
<div class="nav">
<strong>当前位置</strong>:
<s:a action="bbs_list">BBS</s:a> //去了这一行,或者换成<a>标签就没有错误了
&nbsp;&gt;&gt;&nbsp;

</div>
</div>
</body>
</html>


下面是错误提示:
16:45:03,384 ERROR ClosingUIBean:27 - Could not open template
java.lang.NullPointerException
at org.apache.struts2.components.template.TemplateEngineManager.getTemplateEngine(TemplateEngineManager.java:102)
at org.apache.struts2.components.UIBean.mergeTemplate(UIBean.java:549)
at org.apache.struts2.components.ClosingUIBean.start(ClosingUIBean.java:59)
at org.apache.struts2.components.Anchor.start(Anchor.java:132)
at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:53)
at org.apache.jsp.WEB_002dINF.jsp.replyaction.show_jsp._jspx_meth_s_005fa_005f0(show_jsp.java:117)
at org.apache.jsp.WEB_002dINF.jsp.replyaction.show_jsp._jspService(show_jsp.java:86)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:445)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
at org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:154)
at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)
at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:362)