@@ -0,0 +1,2347 @@
+/* %0A    JSPWiki - a JSP-based WikiWiki clone.%0A%0A    Copyright (C) 2001-2002 Janne Jalkanen (Janne.Jalkanen@iki.fi)%0A%0A    This program is free software; you can redistribute it and/or modify%0A    it under the terms of the GNU Lesser General Public License as published by%0A    the Free Software Foundation; either version 2.1 of the License, or%0A    (at your option) any later version.%0A%0A    This program is distributed in the hope that it will be useful,%0A    but WITHOUT ANY WARRANTY; without even the implied warranty of%0A    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A    GNU Lesser General Public License for more details.%0A%0A    You should have received a copy of the GNU Lesser General Public License%0A    along with this program; if not, write to the Free Software%0A    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA%0A */%0A%0Apackage com.ecyrd.jspwiki.tags;%0A%0Aimport javax.servlet.jsp.tagext.BodyContent;%0Aimport javax.servlet.jsp.tagext.BodyTagSupport;%0Aimport javax.servlet.jsp.tagext.Tag;%0A%0A/**%0A * ParamTag submits name-value pairs to the first enclosing %0A * ParamHandler instance. Name and value are strings, and can%0A * be given as tag attributes, or alternatively the value can be %0A * given as the body contents of this tag. %0A * %3Cp%3E%0A * The name-value pair is passed to the closest containing %0A * ancestor tag that implements ParamHandler. %0A */%0Apublic class ParamTag %0A    extends BodyTagSupport%0A%7B%0A%0A    private String m_name;%0A    private String m_value;%0A    %0A    public void release() %0A    %7B%0A        m_name = m_value = null;%0A    %7D%0A    %0A    public void setName( String s ) %0A    %7B%0A        m_name = s;%0A    %7D%0A    %0A    public void setValue( String s ) %0A    %7B%0A        m_value = s;%0A    %7D%0A    %0A    public int doEndTag()%0A    %7B%0A        Tag t = null;%0A        while( (t = getParent()) != null && !(t instanceof ParamHandler) )%0A            ;%0A        if( t != null )%0A        %7B%0A            String val = m_value;%0A            if( val == null )%0A            %7B%0A                BodyContent bc = getBodyContent();%0A                if( bc != null ) %0A                %7B%0A                    val = bc.getString();%0A                %7D%0A            %7D%0A            if( val != null ) %0A            %7B%0A                ((ParamHandler)t).setContainedParameter( m_name, val );%0A            %7D%0A        %7D%0A        %0A        %0A        return EVAL_PAGE;%0A    %7D%0A%7D%0A

Tag for providing name-value pairs to a parent tag