JSP 2.0 Examples - Shuffle Example


Try reloading the page a few times. Both the rows and the columns are shuffled and appear different each time.

Here's how the code works. The SimpleTag handler called <my:shuffle> accepts three attributes. Each attribute is a JSP Fragment, meaning it is a fragment of JSP code that can be dynamically executed by the shuffle tag handler on demand. The shuffle tag handler executes the three fragments in a random order. To shuffle both the rows and the columns, the shuffle tag is used with itself as a parameter.


#
!
@
2
3
1
C
B
A