1 13 package mondrian.web.taglib; 14 15 import org.w3c.dom.Document ; 16 17 import javax.servlet.jsp.JspException ; 18 import javax.servlet.jsp.tagext.TagSupport ; 19 import javax.xml.transform.Transformer ; 20 import javax.xml.transform.dom.DOMSource ; 21 import javax.xml.transform.stream.StreamResult ; 22 23 43 44 public class TransformTag extends TagSupport { 45 46 public TransformTag() { 47 } 48 49 public int doEndTag() throws javax.servlet.jsp.JspException { 50 try { 51 ApplResources ar = ApplResources.getInstance(pageContext.getServletContext()); 52 ResultCache rc = ResultCache.getInstance(pageContext.getSession(), pageContext.getServletContext(), query); 53 Document doc = rc.getDOM(); 54 Transformer transformer = ar.getTransformer(xsltURI, xsltCache); 56 transformer.transform(new DOMSource (doc), new StreamResult (pageContext.getOut())); 57 } 58 catch (Exception e) { 59 e.printStackTrace(); 60 throw new JspException (e); 61 } 62 return EVAL_PAGE; 63 } 64 65 67 public void setQuery(String newQuery) { 68 query = newQuery; 69 } 70 public String getQuery() { 71 return query; 72 } 73 74 76 public void setXsltURI(String newXsltURI) { 77 xsltURI = newXsltURI; 78 } 79 public String getXsltURI() { 80 return xsltURI; 81 } 82 83 85 public void setXsltCache(boolean newXsltCache) { 86 xsltCache = newXsltCache; 87 } 88 public boolean isXsltCache() { 89 return xsltCache; 90 } 91 92 private String query; 93 private String xsltURI; 94 private boolean xsltCache; 95 96 97 } 98 99 | Popular Tags |