RadioTag.java :  » Portal » stringbeans-3.5 » com » nabhinc » portlet » mvcportlet » taglib » Java Open Source

Java Open Source » Portal » stringbeans 3.5 
stringbeans 3.5 » com » nabhinc » portlet » mvcportlet » taglib » RadioTag.java
/*
 * (C) Copyright 2004 Nabh Information Systems, Inc.
 *
 * All copyright notices regarding Nabh's products MUST remain
 * intact in the scripts and in the outputted HTML.
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 2.1 
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 */
package com.nabhinc.portlet.mvcportlet.taglib;

import java.io.IOException;

import javax.portlet.RenderRequest;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;

/**
 * Radio tag.
 *
 * @author Padmanabh Dabke
 * (c) 2004 Nabh Information Systems, Inc. All Rights Reserved.
 */
public class RadioTag extends InputTag {
    
  public RadioTag() {
        super();
        setType("radio");

    }
   
    public void doStartTagHelper(RenderRequest request, JspWriter out)
    throws JspException, IOException {
      String value = getValue();

    if (value == null) {
      throw new JspException("Found a radio group containing a member without a value.");
    }
      
        out.write(" value=\"");
        out.write(value);
        out.write("\"");

        String checkedValue = getParamValue(request);
        if (value.equals(checkedValue)) {
          out.write(" checked=\"checked\" ");
        } 
    }

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.