FileDocCategorySizeDatePackage
CreditCardTag.javaAPI DocJBoss 4.2.13221Fri Jul 13 20:56:04 BST 2007xpetstore.web.taglib

CreditCardTag

public class CreditCardTag extends javax.servlet.jsp.tagext.TagSupport
This is an example of JSP taglib. This taglib show the list of all the credit card to use for payments
author
Herve Tchepannou
jsp.tag
name="creditcard" body-content="empty" display-name="xPetStore CreditCard Tag"

Fields Summary
private String
_name
private String
_css
private String
_value
Constructors Summary
Methods Summary
public intdoEndTag()

see
javax.servlet.jsp.tagext.Tag#doEndTag()

        try
        {
            StringBuffer buff = new StringBuffer(  );

            /* <select> */
            buff.append( "<select name='" ).append( _name ).append( "'" );

            if ( _css != null )
            {
                buff.append( " class='" ).append( _css ).append( "'" );
            }

            buff.append( ">" );

            Iterator it = CreditCardNames.all(  ).iterator(  );

            while ( it.hasNext(  ) )
            {
                String cc = it.next(  ).toString(  );

                /* <option> */
                buff.append( "<option value='" ).append( cc ).append( "'" );

                if ( cc.equals( _value ) )
                {
                    buff.append( " selected" );
                }

                buff.append( ">" );

                /* value */
                buff.append( cc );

                /* </option> */
                buff.append( "</option>" );
            }

            /* </select> */
            buff.append( "</select>" );

            pageContext.getOut(  ).println( buff.toString(  ) );

            System.out.println( "customerForm=" + pageContext.getAttribute( "customerForm" ) );

            return EVAL_PAGE;
        }
        catch ( Exception e )
        {
            throw new JspException( e );
        }
    
public java.lang.StringgetCss()
Returns the css.

return
String
jsp.attribute

        return _css;
    
public java.lang.StringgetName()
Returns the name.

return
String
jsp.attribute
required="true"

        return _name;
    
public java.lang.StringgetValue()
Returns the value.

return
String
jsp.attribute
rtexprvalue="true"

        return _value;
    
public voidsetCss(java.lang.String css)
Sets the css.

param
css The css to set

        _css = css;
    
public voidsetName(java.lang.String name)
Sets the name.

param
name The name to set

        _name = name;
    
public voidsetValue(java.lang.String value)
Sets the value.

param
value The value to set

        _value = value;