1 16 17 package org.apache.taglibs.standard.examples.taglib; 18 19 import java.util.Locale ; 20 import javax.servlet.jsp.JspException ; 21 import javax.servlet.jsp.jstl.core.LoopTagSupport; 22 23 29 public class LocalesTag extends LoopTagSupport { 30 31 private static final Locale [] locales = Locale.getAvailableLocales(); 32 private int pointer; 33 private String varTotal; 34 35 public void setVarTotal( String value ) { 36 varTotal = value; 37 } 38 39 public void prepare() { 40 pointer = 0; 41 if ( varTotal!=null && varTotal.length()>0 ) { 42 pageContext.setAttribute( varTotal, new Integer (locales.length) ); 43 } 44 45 } 46 47 public boolean hasNext() { 48 return pointer < locales.length; 49 } 50 51 public Object next() { 52 return locales[ pointer++ ]; 53 } 54 55 public void setBegin( int value ) { 56 super.begin = value; 57 } 58 59 public void setEnd( int value ) { 60 super.end = value; 61 } 62 } 63 | Popular Tags |