Archive for December, 2007

Tuesday, December 11th, 2007

static text that gets written to out. You could use a doEndTag method to complete the HTML for the table. Your doEndTagmethod could resemble the following: public int doEndTag() { JspWriter out = pageContent.getOut() ; //Several out.print statements that finish the table return EVAL_PAGE; } The preceding example returned a constant instructing the JSP container to continue processing the remainder of the JSP page. At times, you may want to skip the remainder of the page. Imagine your JSP page is laid out such that if a certain condition arises after you process the tag body, you do not want to process the remainder of the JSP page. For instance, a condition may arise when a registered user logs onto a system and the remainder of the page shows user information; but if that user is not registered, no information is displayed and there s no need to process the remainder of the page. Your doEndTag method could resemble the following: public int doEndTag() { if (conditionFromEvalTagMeansSkipRestofPage) return SKIP_PAGE; else return EVAL_PAGE ; } Now you know how to conditionally process the remainder of the page. Next, you can see how to code the tld to describe a custom tag with a body. The tld That Dwescribes the Tag with a Body To code the tld to describe a custom tag with a body, you need make only a single change to the tld. Listing 7-7 shows the tld tag entry for a tag with a body. Listing 7-7: Tag library descriptor entry for a tag with a body formatLine chapter7.formatLine Write Body of Text to Page JSP

  • You are currently browsing the SBC Web Hosting - JSP and Java On the Edge weblog archives for December, 2007.

  • Archives

  • Categories