Struts2的JSP页面跳转的问题
当程序抛出异常时,我希望能手动转到另外个页面怎么转?我的代码错了吗?代码如下:JSP页面(导入了STRUTS2TAG):<fontsize=20,color="blue"...
当程序抛出异常时,我希望能手动转到另外个页面怎么转? 我的代码错了吗?代码如下:
JSP页面(导入了STRUTS2 TAG):
<font size=20, color="blue">Exception occurred,Please retry!</font>
<a href="<s:url action="Back"/>">Try Again</a>
Struts.xml的配置Grade.jsp是我希望跳转的页面):
<action name="Back" class="web.action.Back">
<result name="back">WEB-INF/jsp/Grade.jsp</result>
</action>
对应的Action类:
package web.action;
import com.opensymphony.xwork2.ActionSupport;
public class Back extends ActionSupport {
@Override
public String execute() throws Exception {
return "back";
}
}
有错吗? 为什么有此报错信息:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
root cause
org.apache.jasper.JasperException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:460)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
......
root cause
java.lang.NullPointerException
java.util.Hashtable.get(Unknown Source)
org.apache.catalina.session.StandardSession.getAttribute(StandardSession.java:1024)
org.apache.catalina.session.StandardSessionFacade.getAttribute(StandardSessionFacade.java:110)
org.apache.jsp.WEB_002dINF.jsp.Grade_jsp._jspService(Grade_jsp.java:80)
......
把<a href="<s:url action="Back"/>">Try Again</a>
改 <a href="Back.action">Try Again</a>也是一样
全局是自动跳转吧? 那不是我那个错误页面也多余? 有什么方法能解决问题并且让用户点击才执行页面跳转? 谢谢啊 展开
JSP页面(导入了STRUTS2 TAG):
<font size=20, color="blue">Exception occurred,Please retry!</font>
<a href="<s:url action="Back"/>">Try Again</a>
Struts.xml的配置Grade.jsp是我希望跳转的页面):
<action name="Back" class="web.action.Back">
<result name="back">WEB-INF/jsp/Grade.jsp</result>
</action>
对应的Action类:
package web.action;
import com.opensymphony.xwork2.ActionSupport;
public class Back extends ActionSupport {
@Override
public String execute() throws Exception {
return "back";
}
}
有错吗? 为什么有此报错信息:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
root cause
org.apache.jasper.JasperException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:460)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
......
root cause
java.lang.NullPointerException
java.util.Hashtable.get(Unknown Source)
org.apache.catalina.session.StandardSession.getAttribute(StandardSession.java:1024)
org.apache.catalina.session.StandardSessionFacade.getAttribute(StandardSessionFacade.java:110)
org.apache.jsp.WEB_002dINF.jsp.Grade_jsp._jspService(Grade_jsp.java:80)
......
把<a href="<s:url action="Back"/>">Try Again</a>
改 <a href="Back.action">Try Again</a>也是一样
全局是自动跳转吧? 那不是我那个错误页面也多余? 有什么方法能解决问题并且让用户点击才执行页面跳转? 谢谢啊 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询