大雑把な流れは以下の通り
DynaActionForm dForm = (DynaActionForm)form; int n = ((Integer)dForm.get("xxx")).intValue();
HttpServletRequest req = RequestUtil.getRequest(); Enumeration<String> e = req.getHeaderNames(); while( e.hasMoreElements() ) { String s = e.nextElement(); System.out.println(s + "=" +req.getHeader(s) ); }
HttpServletRequest req = RequestUtil.getRequest(); HttpSession session = req.getSession(); session.setAttribute(Globals.LOCALE_KEY, Locale.ENGLISH);
@Resource protected Map requestScope; @Execute(validator = false) public String test(){ String requestUri = (String)requestScope.get("javax.servlet.forward.request_uri"); String contextPath =(String)requestScope.get("javax.servlet.forward.context_path"); String servletPath =(String)requestScope.get("javax.servlet.forward.servlet_path"); String pathInfo =(String)requestScope.get("javax.servlet.forward.path_info"); String queryString =(String)requestScope.get("javax.servlet.forward.query_string"); System.out.println(requestUri); System.out.println(contextPath); System.out.println(servletPath); System.out.println(pathInfo); System.out.println(queryString); return "test.html"; }
getContextPath コンテキストパス getServletPath サーブレットパス getPathInfo 拡張パス getPathTranslated 拡張パス(物理パス) getRequestURL リクエスト時のURL getRequestURI コンテキストパスから拡張パスまで
<global-exceptions> <exception key="error.global" type="java.lang.Exception" path="/error.html"/> </global-exceptions> (struts-config.xml)