JSP and JSTL Tutorials - Tutorial Addendum - JSP Tag Java Interface
| |
javax.servlet.jsp.tagext.* Package
javax.servlet.jsp.tagext.* is a Java amalgamation authentic in J2EE
(I saw it in J2EE 1.3.1). This amalgamation contains:
- Tag interface - The abject interface appropriate by a tag chic to collaborate
with the JSP tag addendum facility.
- IterationTag interface - Continued from Tag interface to abutment looping
logic aural custom tags.
- BodyTag interface - Continued from IterationTag interface to acquiesce
custom tags to appraise their own body.
- TagSupport class - Copy accomplishing of IterationTag interface.
- BodyTagSupport class - Copy accomplishing of BodyTag interface.
BodyTag Interface
Since BodyTag interface requires added ability of JSP in adjustment to evaluate
the tag physique properly, we will altercate it later. For now, let s apply
on InterationTag interface only. Actuality is the account of methods appropriate by
InterationTag interface and their calling conditions:
- setPageContext(PageContext pc) - A advice method, alleged afore calling doStartTag()
to canyon the PageContext item to the tag object.
- setParent(Tag t) - A advice method, alleged afore calling doStartTag()
to canyon the ancestor tag item to the accepted tag object, in case the accepted tag
is nested aural addition tag.
- getParent() - A advice method, alleged by adolescent tag classes to admission
grand ancestor tags.
- doStartTag() - An interfacing point, alleged at the alpha of the action of the tag.
- doAfterBody() - An interfacing point, alleged afterwards processing the body.
- doEndTag() - An interfacing point, alleged if accessible to leave the action of the tag.
- release() - An interfacing point, alleged afore catastrophe the action of the tag.
The accomplish acclimated by the JSP tag addendum ability to action a custom tag can be summarized
as follows:
- Instanciating the tag object.
- Calling setPageContext() and setParent() of the tag object.
- Processing attributes of the tag. See my additional addendum on how aspect ethics are
passed to the tag object.
- Calling doStartTag() of the tag object, which may acknowledgment a banderole to appeal for skipping
the physique to accomplish a codicillary physique logic.
- Processing the physique of the tag.
- Calling doAfterBody() of the tag object, which may acknowledgment a banderole to appeal for processing
the physique afresh to accomplish a bend argumentation on the body.
- Calling doEndTag() of the tag object.
- Calling release() of the tag object.
(Continued on next part...)
|
interface, object, calling, called, interfacing, dostarttag, point, process, processing, bodytag, class, iterationtag, custom, notes, method, logic, , tag object, point called, jsp tag, interfacing point, processing the, object calling, calling dostarttag, iterationtag interface, bodytag interface, method called, called before, interfacing point called, tag object calling, called before calling, tag object which, method called before, class dummy implementation, tutorials tutorial notes, tag java interface, tag extension facility, interface extended from, jstl tutorials tutorial, |
Also see ...
i(Continued from antecedent part...)/iImplenting BodyTag Interface TraceTag.javaIn adjustment to affirm my compassionate of the IterationTag interface, I wrotethe af
i(Continued from antecedent part...)/iThe Servlet Chic TraceTagTest_jsp.javaAs we all understand that JSP pages are translated into Servlet classes beforeexecution.
Nested JSTL TagsWhen tags are nested, JSP tag addendum ability offers the adolescent tag anaccess to the ancestor tag by the setParent() adjustment call. You can yield advantage
i(Continued from antecedent part...)/iI am abiding you can apprehend this page, and accept what I am accomplishing with the loop. Warning, my "break" tag is not a absolutely breach statement. If there is any addi
This affiliate explains:How to change Bobcat 4.1.18 accession from using JDK 1.3.1 to using JDK 1.4.1.Compilation issues of using JavaBean classes in bearding packages.
i(Continued from antecedent part...)/iYou will get the afterward accumulation absurdity adage CacheBean is not resolvable: org.apache.jasper.JasperException: Clumsy to abridge chic for JSP
This affiliate explains:How to amount a JavaBean into JSP pages and dispense its properties. Compilation issues of using JavaBean classes in bearding packages.Setti
i(Continued from antecedent part...)/iIt s actual absorbing to see the Servlet chic translated from UseBean.jsp: package org.apache.jsp;import javax.servlet.*;import javax.
i(Continued from antecedent part...)/iIn this section, let s attending at some of the basal rules about ambience and gettingJavaBean properties:The setProperty aspect haveto be accura
i(Continued from antecedent part...)/iNote that:Property names are case sensitive. Acreage name "Author" can not be mapped to "getAuthor" method. Two set method