Taglib principle and implementation Chapter 6: Summary of common methods within the label

xiaoxiao2021-03-06  74

Chapter 6: Common Methods in Tags Summary:

1. Support el expressions: import org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager; private Object value = null; this.value = ExpressionEvaluatorManager.evaluate ( "value", value.toString (), Object.class, this, PageContext);

2. Use beanutil to take the attribute value import org.apache.commons.beanutils.propertyUtils; private string protection = null; Object PropertyValue = PropertyUtils.getProperty;

3. Set the value in the request. PageContext.SetAttribute ("var", propertyvalue);

4. Print PageContext.getOut (). Print (OutputString);

5. Take the parent label, get the desired label, even if it is non-father getParent () FindanceStorwithClass (this, Ancestortag.class);

6. The label comes with the belt method and constant, and the method is arranged in the order in which the container is called. Example dostartTAG: Container resolution to C: if left parentheses ("<") DOINITBODY: The container is resolved to the C: IF right parentheses (">") and C: OUT left parentheses ("<") call DOAFTERBODY: Container resolves to C: OUT End Mark ("/>") call DOENDTAG: Container analysis to C: IF end tag ("/>")

Eval_body_skip: Typically in the DostartTAG method, ignore the content included in the tag, if it returns this value, the above C: IF ignores C: OUTEVAL_BODY_INCLUDE: Typically call in the DoafterBody method, execute Body again, if you return this value, C: above C: OUT is executed multiple EVAL_PAGE: You can call in any method. Return to the JSP page

转载请注明原文地址:https://www.9cbs.com/read-93307.html

New Post(0)