1 18 19 package org.apache.struts.actions; 20 21 import javax.servlet.RequestDispatcher ; 22 import javax.servlet.ServletException ; 23 import javax.servlet.http.HttpServletRequest ; 24 import javax.servlet.http.HttpServletResponse ; 25 26 import org.apache.struts.action.Action; 27 import org.apache.struts.action.ActionForm; 28 import org.apache.struts.action.ActionForward; 29 import org.apache.struts.action.ActionMapping; 30 import org.apache.struts.upload.MultipartRequestWrapper; 31 import org.apache.struts.util.MessageResources; 32 33 58 public class IncludeAction extends Action { 59 60 61 63 64 67 protected static MessageResources messages = 68 MessageResources.getMessageResources 69 ("org.apache.struts.actions.LocalStrings"); 70 71 72 74 75 89 public ActionForward execute( 90 ActionMapping mapping, 91 ActionForm form, 92 HttpServletRequest request, 93 HttpServletResponse response) 94 throws Exception { 95 96 String path = mapping.getParameter(); 98 if (path == null) { 99 throw new ServletException (messages.getMessage("include.path")); 100 } 101 102 RequestDispatcher rd = 103 servlet.getServletContext().getRequestDispatcher(path); 104 105 if (rd == null) { 106 throw new ServletException (messages.getMessage("include.rd", path)); 107 } 108 109 if (request instanceof MultipartRequestWrapper) { 111 request = ((MultipartRequestWrapper) request).getRequest(); 112 } 113 114 rd.include(request, response); 116 117 return (null); 119 120 } 121 122 123 } 124 125 | Popular Tags |