package com.lixing.mobile_scm.web;

import java.io.IOException;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.SimpleTagSupport;

public class NavigateTag extends SimpleTagSupport {

         private int percent = 100;
         private int width = 1000;
         private String text;
         private String widthType = "percent";

         public void setPercent( int percent) {
                 this.percent = percent;
        }

         public void setText(String text) {
                 this.text = text;
        }

         public void setWidth( int width) {
                 this.widthType = "width";
                 this.width = width;
        }

        @Override
         public void doTag() throws JspException, IOException {
                JspWriter out = getJspContext().getOut();
                String tableWidth = this.widthType.equals( "percent") ? (percent + "%")
                                : width + "";
                out.print( "
                                + " cellpadding='0' align='center'>");
                out.print( "");
                out.print( "");
                out.print( "
class='navTd1'>class='navTd2'>" + text + "class='navTd3'>
");
        }

}


xml version ="1.0" encoding ="UTF-8" ?>

< taglib xmlns ="http://java.sun.com/xml/ns/javaee"
   xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation ="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
   version ="2.1" >

   < tlib-version >1.1 tlib-version >
   < short-name >cust short-name >
   < uri >/cust-tags uri >

   < tag >
     < name >navigation name >
     < tag-class >com.lixing.mobile_scm.web.NavigateTag tag-class >
     < body-content >empty body-content >
     < attribute >
       < name >percent name >
       < required >false required >
       < rtexprvalue >true rtexprvalue >
     attribute >
     < attribute >
       < name >width name >
       < required >false required >
       < rtexprvalue >true rtexprvalue >
     attribute >
     < attribute >
       < name >text name >
       < required >true required >
       < rtexprvalue >true rtexprvalue >
     attribute >
   tag >
taglib >