May 2001
Intermediate to advanced
1088 pages
30h 13m
English
Just like regular tags, custom tags can have attribute values. You just need to provide get and set methods for each attribute. Although you enclose each attribute in quotes, you can have numeric attributes in your custom tag. The JSP engine performs the conversion automatically. Listing 16.24 shows a custom tag to display a checkerboard. The board has several options that can be changed by various attributes in the <xx:checkerboard> tag.
import javax.servlet.jsp.tagext.*; import javax.servlet.jsp.*; import java.io.*; public class CheckerboardTag extends TagSupport { // Variables to hold the attributes for the checkerboard protected int width = 40; protected int ... |
Read now
Unlock full access