1 18 19 package org.apache.struts.webapp.tiles.template; 20 21 import javax.servlet.http.HttpServletRequest ; 22 import javax.servlet.http.HttpServletResponse ; 23 import org.apache.struts.action.Action; 24 import org.apache.struts.action.ActionForm; 25 import org.apache.struts.action.ActionForward; 26 import org.apache.struts.action.ActionMapping; 27 import org.apache.struts.tiles.ComponentDefinition; 28 29 30 public final class DynTemplateAction extends Action { 31 32 33 35 36 51 public ActionForward execute( 52 ActionMapping mapping, 53 ActionForm form, 54 HttpServletRequest request, 55 HttpServletResponse response) 56 throws Exception { 57 58 System.out.println( "Start dynamic definition" ); 59 ComponentDefinition definition = new ComponentDefinition(); 61 String path = "/tutorial"; 62 definition.put( "title", "My first dynamic frameset page", true ); 65 definition.put( "header", path + "/common/header.jsp", "string", null ); 67 definition.put( "footer", path + "/common/footer.jsp", true ); 68 definition.put( "menu", path + "/basic/menu.jsp", true ); 69 definition.put( "body", path + "/basic/helloBody.jsp", true ); 70 71 System.out.println( "definition=" + definition ); 72 request.setAttribute( "templateDefinition", definition ); 74 75 return (mapping.findForward("success")); 76 } 77 78 } 79 | Popular Tags |