Package jodd.servlet.tag

Source Code of jodd.servlet.tag.ThenTag

// Copyright (c) 2003-2014, Jodd Team (jodd.org). All Rights Reserved.

package jodd.servlet.tag;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.JspTag;
import javax.servlet.jsp.tagext.SimpleTagSupport;

/**
* Then nested tag for {@link jodd.servlet.tag.IfElseTag}.
*/
public class ThenTag extends SimpleTagSupport {

  @Override
  public void doTag() throws JspException {
    JspTag parent = getParent();
    if (parent == null || !(parent instanceof IfElseTag)) {
      throw new JspException("Parent IfElse tag is required", null);
    }

    IfElseTag ifTag = (IfElseTag) parent;
    if (ifTag.getTestValue()) {
      TagUtil.invokeBody(getJspBody());
    }
  }
}
TOP

Related Classes of jodd.servlet.tag.ThenTag

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.