I'm doing something different than what Freddy does in his book, but he
alludes to this way of doing a layout.  I wanted your feedback to make sure
I'm not doing anything ugly or not kosher.

My action bean is

public class LayoutActionBean extends BaseActionBean {
    private final transient Logger log = LoggerFactory
        .getLogger(LayoutActionBean.class);

    @DefaultHandler
    public Resolution handler() {
        this.log.info("handler called");

        return new ForwardResolution("/WEB-INF/jsp/layout-render.jsp");
    }
}

The layout-render.jsp file is

<stripes:layout-render name="/WEB-INF/jsp/layout-definition.jsp">
    <stripes:layout-component name="menu_short">
        <p><stripes:layout-render name="/WEB-INF/jsp/menu_short.jsp" /></p>
    </stripes:layout-component>

    <stripes:layout-component name="menu_full">
        <p><stripes:layout-render name="/WEB-INF/jsp/menu_full.jsp" /></p>
    </stripes:layout-component>
</stripes:layout-render>

The layout-definition.jsp file is

<stripes:layout-definition>
<!DOCTYPE html>
<html lang="en">
    <head></head>

    <body>
        <p>Menu: ${actionBean.context.menu}</p>

        <p><stripes:layout-component name="${actionBean.context.menu}"
/></p>
    </body>
</html>
</stripes:layout-definition>

And the action bean context is

public class TestActionBeanContext extends ActionBeanContext {
    @SuppressWarnings("static-method")
    public String getMenu() {
        return "menu_full";
    }
}

If I change getMenu to return menu_short then it displays the short menu.

Is this a reasonable way to switch between displaying things?
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://p.sf.net/sfu/Zoho
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to