1 package be.dvw.administration.mvc.actions; 2 3 import org.apache.struts.action.Action; 4 import org.apache.struts.action.ActionForward; 5 import org.apache.struts.action.ActionMapping; 6 import org.apache.struts.action.ActionForm; 7 import org.apache.commons.logging.Log; 8 import org.apache.commons.logging.LogFactory; 9 10 import javax.servlet.http.HttpServletRequest; 11 import javax.servlet.http.HttpServletResponse; 12 13 import be.dvw.administration.Constants; 14 15 import java.io.File; 16 17 18 public final class StaticContentAction extends Action { 19 20 21 private static Log LOG = LogFactory.getLog(StaticContentAction.class); 22 23 /*** 24 * Process the specified HTTP request, and create the corresponding HTTP 25 * response (or forward to another web component that will create it). 26 * Return an <code>ActionForward</code> instance describing where and how 27 * control should be forwarded, or <code>null</code> if the response has 28 * already been completed. 29 * 30 * @param mapping The ActionMapping used to select this instance 31 * @param request The HTTP request we are processing 32 * @param response The HTTP response we are creating 33 * 34 * @exception Exception if business logic throws an exception 35 */ 36 public ActionForward execute(ActionMapping mapping, 37 ActionForm form, 38 HttpServletRequest request, 39 HttpServletResponse response) 40 throws Exception { 41 42 LOG.debug("Entering action"); 43 44 String page = (String) request.getParameter("page"); 45 46 LOG.debug("page = " + page); 47 48 if ( page == null || "".equals(page)) 49 page = "/home"; 50 51 String currentItem = "/dvw-management/StaticPage.do?page=" + page; 52 String pagePath = new StringBuffer().append("/staticContent").append( page ).append(".jsp").toString(); 53 54 request.setAttribute( Constants.PAGE, page); 55 request.setAttribute( Constants.PAGE_CURRENT_ITEM, currentItem ); 56 request.setAttribute( Constants.PAGE_PATH_KEY, pagePath ); 57 LOG.debug("Forwarding to the success mapping, page is: " + pagePath); 58 return mapping.findForward("success"); 59 60 61 62 63 64 } 65 }