1 package org.apache.turbine.services.jsp.tags; 2 3 18 19 import java.io.IOException ; 20 import javax.servlet.jsp.JspException ; 21 import javax.servlet.jsp.PageContext ; 22 import javax.servlet.jsp.tagext.TagSupport ; 23 import org.apache.turbine.modules.NavigationLoader; 24 import org.apache.turbine.services.TurbineServices; 25 import org.apache.turbine.services.jsp.JspService; 26 import org.apache.turbine.services.template.TemplateService; 27 import org.apache.turbine.util.Log; 28 import org.apache.turbine.util.RunData; 29 import org.apache.turbine.util.template.TemplateInfo; 30 31 42 public class NavigationTag extends TagSupport 43 { 44 48 private String template; 49 50 53 public void setTemplate(String template) 54 { 55 this.template = template; 56 } 57 58 64 public int doStartTag() throws JspException 65 { 66 RunData data = (RunData)pageContext 67 .getAttribute(JspService.RUNDATA, PageContext.REQUEST_SCOPE); 68 data.getTemplateInfo().setNavigationTemplate(template); 69 String module = null; 70 try 71 { 72 pageContext.getOut().flush(); 73 module = ((TemplateService)TurbineServices.getInstance().getService( 74 TemplateService.SERVICE_NAME)).getNavigationName(template); 75 NavigationLoader.getInstance().exec(data, module); 76 } 77 catch (Exception e) 78 { 79 String message = "Error processing navigation template:" + 80 template + " using module: " + module; 81 Log.error(message, e); 82 try 83 { 84 data.getOut().print("Error processing navigation template: " 85 + template + " using module: " + module); 86 } 87 catch(java.io.IOException ioe) {} 88 } 89 return SKIP_BODY; 90 } 91 } 92 | Popular Tags |