博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Structs2 全局异常界面,发生异常均进入此界面
阅读量:5169 次
发布时间:2019-06-13

本文共 1314 字,大约阅读时间需要 4 分钟。

struts.xml  其中个界面的name  均可随机应变

/message.jsp
/ok.jsp
/ok.jsp
message.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"    pageEncoding="UTF-8"%>
Insert title here 发生异常,${message },进入了异常消息界面!
ok.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"    pageEncoding="UTF-8"%>
Insert title here 正常来的界面!
StuAction.java
package com.edusk.action;import com.opensymphony.xwork2.ActionSupport;public class StuAction extends ActionSupport {    private static final long serialVersionUID = 1L;    public String login() {        int a = 1/0;        return SUCCESS;    }}
UserAction.java
package com.edusk.action;import com.opensymphony.xwork2.ActionSupport;public class UserAction extends ActionSupport {    private static final long serialVersionUID = 1L;    public String login() {        int a = 1/0;        return SUCCESS;    }}

 

 

转载于:https://www.cnblogs.com/w198/p/5798901.html

你可能感兴趣的文章