List of usage examples for javax.servlet.jsp.tagext Tag doStartTag
int doStartTag() throws JspException;
From source file:de.micromata.genome.gwiki.page.gspt.TagSupport.java
/** * @return true if body should be included *//* ww w. jav a 2 s . c o m*/ 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 *///from ww w. j a va 2 s.c o m 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: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/*ww w . j a v a 2 s .c o m*/ * @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
public ProcessStatus doStartProcess(Page topLevelPage) { if (_tagClass == null) { throw new IllegalStateException(); }//from w ww .j a v a 2 s . c om topLevelPage.registBeginRenderNotifier(this); clearLoadedTag(); Tag customTag = getLoadedTag(); // javax.servlet.jsp.tagext.SimpleTag Object targetTag = customTag; if (customTag instanceof SimpleTagWrapper) { SimpleTagWrapper simpleTagWrapper = (SimpleTagWrapper) customTag; SimpleTag simpleTag = simpleTagWrapper.getSimpleTag(); int childProcessorSize = getChildProcessorSize(); if (childProcessorSize > 0) { simpleTag.setJspBody(new ProcessorFragment(simpleTagWrapper, this, topLevelPage)); } targetTag = simpleTag; } for (Iterator it = iterateProperties(); it.hasNext();) { ProcessorProperty property = (ProcessorProperty) it.next(); ObjectUtil.setProperty(targetTag, property.getName().getQName().getLocalName(), property.getValue().execute(null)); } // javax.servlet.jsp.tagext.DynamicAttributes if (TLDProcessorDefinition.class.isAssignableFrom(getProcessorDefinition().getClass())) { TLDProcessorDefinition tldDef = (TLDProcessorDefinition) getProcessorDefinition(); if (tldDef.isDynamicAttribute()) { setupDynamicAttributes(customTag); } } ProcessorTreeWalker processor = this; while ((processor = processor.getParentProcessor()) != null) { if (processor instanceof JspProcessor) { JspProcessor jspProcessor = (JspProcessor) processor; Tag parentTag = jspProcessor.getLoadedTag(); if (parentTag == null) { throw new IllegalStateException("the parent processor has no custom tag."); } customTag.setParent(parentTag); break; } } try { pushNestedVariables(); return getProcessStatus(customTag.doStartTag(), true); } catch (JspException e) { throw createJspRuntimeException(getOriginalNode(), getInjectedNode(), e); } }