FileDocCategorySizeDatePackage
ShuffleSimpleTag.javaAPI DocGlassfish v2 API3948Fri May 04 22:34:22 BST 2007jsp2.examples.simpletag

ShuffleSimpleTag

public class ShuffleSimpleTag extends javax.servlet.jsp.tagext.SimpleTagSupport
SimpleTag handler that accepts takes three attributes of type JspFragment and invokes then in a random order.

Fields Summary
private javax.servlet.jsp.tagext.JspFragment
fragment1
private javax.servlet.jsp.tagext.JspFragment
fragment2
private javax.servlet.jsp.tagext.JspFragment
fragment3
Constructors Summary
Methods Summary
public voiddoTag()

        switch( (int)(Math.random() * 6) ) {
            case 0:
                fragment1.invoke( null );
                fragment2.invoke( null );
                fragment3.invoke( null );
                break;
            case 1:
                fragment1.invoke( null );
                fragment3.invoke( null );
                fragment2.invoke( null );
                break;
            case 2:
                fragment2.invoke( null );
                fragment1.invoke( null );
                fragment3.invoke( null );
                break;
            case 3:
                fragment2.invoke( null );
                fragment3.invoke( null );
                fragment1.invoke( null );
                break;
            case 4:
                fragment3.invoke( null );
                fragment1.invoke( null );
                fragment2.invoke( null );
                break;
            case 5:
                fragment3.invoke( null );
                fragment2.invoke( null );
                fragment1.invoke( null );
                break;
        }
    
public voidsetFragment1(javax.servlet.jsp.tagext.JspFragment fragment1)

        this.fragment1 = fragment1;
    
public voidsetFragment2(javax.servlet.jsp.tagext.JspFragment fragment2)

        this.fragment2 = fragment2;
    
public voidsetFragment3(javax.servlet.jsp.tagext.JspFragment fragment3)

        this.fragment3 = fragment3;