package struts;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.ServletContext;
import org.apache.struts.action.*;
public final class ExExceptionAction extends Action {
//(1)throws Exceptionを指定
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest req,
HttpServletResponse res) throws Exception {
//(2)0で除算して、例外を発生させる
int discount = 100/0;
return (mapping.findForward("info"));
}
}
|