FileDocCategorySizeDatePackage
If.javaAPI DocApache Tomcat 6.0.142186Fri Jul 20 04:20:34 BST 2007org.apache.jasper.tagplugins.jstl.core

If

public final class If extends Object implements TagPlugin

Fields Summary
Constructors Summary
Methods Summary
public voiddoTag(TagPluginContext ctxt)

        String condV = ctxt.getTemporaryVariableName();
        ctxt.generateJavaSource("boolean " + condV + "=");
        ctxt.generateAttribute("test");
        ctxt.generateJavaSource(";");
        if (ctxt.isAttributeSpecified("var")) {
            String scope = "PageContext.PAGE_SCOPE";
            if (ctxt.isAttributeSpecified("scope")) {
                String scopeStr = ctxt.getConstantAttribute("scope");
                if ("request".equals(scopeStr)) {
                    scope = "PageContext.REQUEST_SCOPE";
                } else if ("session".equals(scopeStr)) {
                    scope = "PageContext.SESSION_SCOPE";
                } else if ("application".equals(scopeStr)) {
                    scope = "PageContext.APPLICATION_SCOPE";
                }
            }
            ctxt.generateJavaSource("_jspx_page_context.setAttribute(");
            ctxt.generateAttribute("var");
            ctxt.generateJavaSource(", new Boolean(" + condV + ")," + scope + ");");
        }
        ctxt.generateJavaSource("if (" + condV + "){");
        ctxt.generateBody();
        ctxt.generateJavaSource("}");