1 16 17 package org.apache.jetspeed.modules.parameters; 18 19 import org.apache.turbine.util.RunData; 21 import org.apache.turbine.services.TurbineServices; 22 import org.apache.turbine.services.jsp.JspService; 23 24 import java.util.Map ; 26 27 import org.apache.jetspeed.services.TemplateLocator; 29 import org.apache.jetspeed.services.logging.JetspeedLogFactoryService; 30 import org.apache.jetspeed.services.logging.JetspeedLogger; 31 32 54 55 public class JspParameterPresentationStyle extends ParameterPresentationStyle 56 { 57 58 61 private static final JetspeedLogger logger = JetspeedLogFactoryService.getLogger(JspParameterPresentationStyle.class.getName()); 62 63 72 public String getContent(RunData data, String name, String value, Map parms) 73 { 74 String result = null; 75 76 JspService jspService = (JspService) TurbineServices.getInstance().getService(JspService.SERVICE_NAME); 78 79 data.getRequest().setAttribute("data", data); 81 data.getRequest().setAttribute("name", name); 82 data.getRequest().setAttribute("value", value); 83 data.getRequest().setAttribute("parms", parms); 84 data.getRequest().setAttribute("events", this.getJavascriptEvents()); 85 86 try 87 { 88 this.buildContext(data, name, value, parms); 90 91 String className = this.getClass().getName(); 93 int pos = className.lastIndexOf("."); 94 pos = pos < 0 ? 0 : pos + 1; 95 className = className.substring(pos); 96 97 String template = (String ) this.getParm("template", className + ".jsp"); 99 String templatePath = TemplateLocator.locateParameterTemplate(data, template); 100 jspService.handleRequest(data, templatePath); 101 result = ""; 102 } 103 catch (Exception e) 104 { 105 logger.error("Exception", e); 106 result = "<input type=\"text\" name=\"" + name + "\" value=\"" + value + "\""; 108 } 109 110 return result; 111 112 } 113 114 123 public void buildContext(RunData data, String name, String value, Map parms) 124 { 125 126 } 127 } | Popular Tags |