List of usage examples for javax.servlet.jsp.tagext Tag setPageContext
void setPageContext(PageContext pc);
From source file:de.micromata.genome.gwiki.page.gspt.TagSupport.java
/** * @return true if body should be included *//*from w w w .j a v a 2s .c om*/ public static boolean initTag(Tag tag, List<Object> attributes, ChildPageContext ctx) throws Exception { Tag ptag = ctx.getCurrentTag(); if (log.isDebugEnabled()) log.debug("Init tag: " + tag.getClass().getName()); PageContext pctx = ctx; if (ctx.isUseParentTagContext() == true) pctx = ctx.getParentPageContext(); tag.setPageContext(pctx); tag.setParent(ptag); attributes = evalAttributes(tag, attributes, ctx); setAttributes(tag, attributes, ctx); ctx.setCurrentTag(tag); int r = tag.doStartTag(); ctx.getTagStack().push(new Pair<Tag, Integer>(tag, r)); JspWriter oout = pctx.getOut(); ctx.setInternalGroovyOut(createPrintWriter(oout)); if (r != javax.servlet.jsp.tagext.Tag.SKIP_BODY && r != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE && tag instanceof BodyTag) { BodyTag btag = (BodyTag) tag; JspWriter out = pctx.pushBody(); PrintWriterPatched newPout = createPrintWriter(out, true); ctx.setInternalGroovyOut(newPout); btag.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out); btag.doInitBody(); } boolean ret = r != javax.servlet.jsp.tagext.Tag.SKIP_BODY; if (log.isDebugEnabled()) log.debug("Init tag: " + tag.getClass().getName() + ": " + ret); return ret; }
From source file:de.micromata.genome.gwiki.page.gspt.TagSupport.java
/** * @return if return false page will be skipped *//* w w w . j a v a2 s.c om*/ public static boolean initSimpleTag(Tag tag, List<Object> attributes, ChildPageContext ctx) throws Exception { if (log.isDebugEnabled()) log.debug("Init simple tag: " + tag.getClass().getName()); Tag ptag = ctx.getCurrentTag(); PageContext pctx = ctx;// .getBrickContext().getPageContext(); if (ctx.isUseParentTagContext() == true) pctx = ctx.getParentPageContext(); tag.setPageContext(pctx); tag.setParent(ptag); attributes = evalAttributes(tag, attributes, ctx); setAttributes(tag, attributes, ctx); ctx.setCurrentTag(tag); int r = tag.doStartTag(); // ctx.getTagStack().push(new Pair<Tag, Integer>(tag, r)); r = tag.doEndTag(); // ctx.getTagStack().pop(); ctx.setCurrentTag(ptag); return r != javax.servlet.jsp.tagext.Tag.SKIP_PAGE; }
From source file:de.micromata.genome.gwiki.page.impl.wiki.macros.GWikiJspTagMacro.java
public boolean renderTag(Tag tag, MacroAttributes attrs, GWikiContext ctx) { tag.setPageContext(ctx.getCreatePageContext()); if (tag instanceof BodyTag) { return renderBodyTag((BodyTag) tag, attrs, ctx); }//from ww w .j a va 2 s .c o m return renderNoBodyTag(tag, attrs, ctx); }
From source file:com.icesoft.faces.webapp.parser.Parser.java
/** * This member mimicks the JSP tag processing lifecyle across the tag * processing tree to produce the JSF component tree. * * @param wire The tag's wire/*w w w. j a va 2 s . c om*/ * @param pageContext The page context * @param facesContext The faces context * @param componentIds * @throws JspException */ public void executeJspLifecycle(TagWire wire, PageContext pageContext, FacesContext facesContext, Set componentIds) throws JspException { // Start of lifecycle; boolean processingViewTag = false; Tag tag = wire.getTag(); tag.setPageContext(pageContext); // Start tag processing; tag.doStartTag(); UIComponent myComponent = null; // reference will be used after doEndTag if (tag instanceof UIComponentTag) { UIComponentTag compTag = (UIComponentTag) tag; myComponent = compTag.getComponentInstance(); if (myComponent != null) { if (myComponent instanceof UIViewRoot) { myComponent.setId("_view"); processingViewTag = true; } String componentId = myComponent.getClientId(facesContext); if (componentIds.contains(componentId)) throw new IllegalStateException("Duplicate component ID : " + componentId); componentIds.add(componentId); } } // Now process tag children; Iterator children = wire.getChildren().iterator(); while (children.hasNext()) { TagWire childWire = (TagWire) children.next(); executeJspLifecycle(childWire, pageContext, facesContext, componentIds); } //Do tag body processing. This is not full-fledged body processing. It only calls the doAfterBody() member if (!processingViewTag && tag instanceof UIComponentBodyTag) { UIComponentBodyTag bodyTag = (UIComponentBodyTag) tag; if (bodyTag.getBodyContent() == null) { //body content of custom tag should not be null, so create one in here to satisfy the //checking in jsf 1.0 impl. JspWriter jspWriter = new JspWriterImpl(new PrintWriter(System.out)); BodyContentImpl imp = new BodyContentImpl(jspWriter); bodyTag.setBodyContent(imp); } bodyTag.doAfterBody(); } // Do end tag processing; tag.doEndTag(); // ICE-3443: to save memory, trim the COMPONENT_IDS list capacity // to its actual size if (null != myComponent) { Map attributes = myComponent.getAttributes(); ArrayList idsList = (ArrayList) attributes.get("javax.faces.webapp.COMPONENT_IDS"); if (null != idsList) { idsList.trimToSize(); } } }
From source file:org.seasar.mayaa.impl.engine.processor.JspProcessor.java
protected Tag getLoadedTag() { Tag tag = (Tag) CycleUtil.getLocalVariable(LOADED_TAG_KEY, this, null); if (tag == null) { tag = getTagPool().borrowTag();/*from www . j av a 2 s . co m*/ tag.setPageContext(_pageContext); CycleUtil.setLocalVariable(LOADED_TAG_KEY, this, tag); } return tag; }