Barcode.java Sample

This topic inludes the source code for the Barcode.java Sample.

Sample Location

This sample is located in the following directory in your WebLogic Workshop installation:

BEA_HOME/weblogic81/samples/workshop/ExtensionDevKit/TaglibExtDevKit/TagHandlers/TDK/

Sample Source Code


01 
02 package TDK;
03 
04 import java.util.ArrayList;
05 import javax.servlet.jsp.JspException;
06 import javax.servlet.jsp.PageContext;
07 import javax.servlet.jsp.tagext.Tag;
08 import javax.servlet.jsp.tagext.BodyTagSupport;
09 
10 public class Barcode extends BodyTagSupport
11 {
12   protected String encodingType = null;
13   public void setEncodingType(String type)
14   {
15     encodingType = type;
16   }
17   public String getEncodingType()
18   {
19     return encodingType;
20   }
21   
22     protected String value = null;
23     public void setValue(String value)
24     {
25         this.value = value;
26     }
27     public String getValue()
28     {
29         return value;
30     }
31 
32     public int doStartTag() throws JspException
33     {
34         return EVAL_BODY_TAG;
35     }
36 
37     public int doEndTag() throws JspException
38     {
39     StringBuffer html = new StringBuffer();
40     html.append("<div>");
41     html.append("SUCCESS: value to encode=" + value);
42     html.append("</div>");  
43     try
44     {  
45       pageContext.getOut().print(html.toString());
46     }
47     catch(Exception e) { e.printStackTrace()}
48     return EVAL_PAGE;
49     }
50 }