Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
14.4 Including the Tag Body
325
Listing 14.10 HeadingTag.java
package coreservlets.tags;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import java.io.*;
/** Generates an HTML heading with the specified background
* color, foreground color, alignment, font, and font size.
* You can also turn on a border around it, which normally
* just barely encloses the heading, but which can also
* stretch wider. All attributes except the background
* color are optional.
*/
public class HeadingTag extends TagSupport {
private String bgColor; // The one required attribute
private String color = null;
private String align="CENTER";
private String fontSize="36";
private String fontList="Arial, Helvetica, sans serif";
private String border="0";
private String width=null;
public void setBgColor(String bgColor) {
this.bgColor = bgColor;
}
public void setColor(String color) {
this.color = color;
}
public void setAlign(String align) {
this.align = align;
}
public void setFontSize(String fontSize) {
this.fontSize = fontSize;
}
public void setFontList(String fontList) {
this.fontList = fontList;
}
public void setBorder(String border) {
this.border = border;
}
public void setWidth(String width) {
this.width = width;
}
Second edition of this book: www.coreservlets.com; Sequel: www.moreservlets.com.
Servlet and JSP training courses by book's author: courses.coreservlets.com.
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved