1 package org.apache.jetspeed.services.jsp.tags; 2 3 18 19 import javax.servlet.jsp.JspException ; 20 import javax.servlet.jsp.PageContext ; 21 import javax.servlet.jsp.tagext.TagSupport ; 22 23 import org.apache.turbine.util.RunData; 25 import org.apache.turbine.util.template.TemplateLink; 26 import org.apache.turbine.services.jsp.JspService; 27 28 import org.apache.jetspeed.services.logging.JetspeedLogFactoryService; 30 import org.apache.jetspeed.services.logging.JetspeedLogger; 31 32 39 public class DynamicURITag extends TagSupport 40 { 41 44 private static final JetspeedLogger logger = JetspeedLogFactoryService.getLogger(DynamicURITag.class.getName()); 45 46 49 private String screen; 50 51 54 public void setScreen(String screen) 55 { 56 this.screen = screen; 57 } 58 59 62 private String template; 63 64 67 public void setTemplate(String template) 68 { 69 this.template = template; 70 } 71 72 75 private String action; 76 77 80 public void setAction(String action) 81 { 82 this.action = action; 83 } 84 85 public int doStartTag() throws JspException 86 { 87 RunData data = (RunData)pageContext.getAttribute(JspService.RUNDATA, PageContext.REQUEST_SCOPE); 88 89 TemplateLink uri = new TemplateLink( data ); 90 if ( template != null ) uri.setPage( template ); 91 if ( screen != null ) uri.setScreen( screen ); 92 if ( action != null ) uri.setAction( action ); 93 94 try 95 { 96 if (uri != null) { 97 pageContext.getOut().print(uri.toString()); 98 } 99 } 100 catch (Exception e) 101 { 102 String message = "Error processing DynamicUriTag, parameter: screen='"+ screen + "', action='" +action +"'"; 103 logger.error(message, e); 104 try 105 { 106 data.getOut().print( message ); 107 } 108 catch(java.io.IOException ioe) {} 109 } 110 111 return EVAL_BODY_INCLUDE; 112 } 113 114 } 115 | Popular Tags |