1 16 17 package org.apache.taglibs.regexp; 18 19 import java.util.*; 20 import javax.servlet.*; 21 import javax.servlet.http.*; 22 import javax.servlet.jsp.*; 23 import javax.servlet.jsp.tagext.*; 24 25 50 51 public class GroupTag extends TagSupport 52 { 53 private int number = 0; 54 55 60 public final int doEndTag() throws JspException 61 { 62 MatchTag mt = null; 63 try { 64 mt = (MatchTag)this.findAncestorWithClass(this, 65 Class.forName("org.apache.taglibs.regexp.MatchTag")); 66 } catch(Exception e) { 67 } 68 if( mt == null ) 69 throw new JspException("regexp group tag could not find a parent match tag."); 70 71 String value = mt.getGroup(number); 72 73 try { 74 pageContext.getOut().write(value); 75 } catch(Exception e) { 76 throw new JspException("IO Error: " + e.getMessage()); 77 } 78 79 return EVAL_PAGE; 80 } 81 82 88 public final void setNumber(int number) 89 { 90 this.number = number; 91 } 92 93 } 94 | Popular Tags |