Sample Application

Skip to end of metadata
Go to start of metadata

A standalone sample application called Bugzooky is included in the Stripes Download. Browsing the source code and JSPs for the application is one of the best ways to get to grips with some of the more advanced features of Stripes.

The Bugzooky sample application has examples of how to use the following features (among others):

  • Indexed properties (aka multi-row forms)
  • File upload
  • Streaming data back to the client for download
  • Built in and custom validation
  • Multiple events from a single form
  • Re-using the same pages and ActionBeans for add flows and edit flows

The Stripes Download includes a pre-built war file that includes the example application, as well as the source for the example. A few screen shots and an example class and JSP follow to whet your appetite.

<%@ include file="/bugzooky/taglibs.jsp" %>

<stripes:layout-render name="/bugzooky/layout/standard.jsp" title="Bulk Add/Edit Bugs">
    <stripes:layout-component name="contents">

        <jsp:useBean id="componentManager" scope="page"
        <jsp:useBean id="personManager" scope="page"

        <stripes:form action="/examples/bugzooky/MultiBug.action" focus="">

            <table class="display">
                    <th><stripes:label name=""/></th>
                    <th><stripes:label name=""/></th>
                    <th><stripes:label name="bugs.priority"/></th>
                    <th><stripes:label name="bugs.shortDescription"/></th>
                    <th><stripes:label name="bugs.longDescription"/></th>

                    <c:when test="${actionBean != null}">
                        <c:set var="list" value="${actionBean.bugs}" scope="page"/>
                        <c:set var="list" value="<%= new Object[5] %>" scope="page"/>

                <c:forEach items="${list}" var="bug" varStatus="loop">
                            <stripes:hidden name="bugs[${loop.index}].id"/>
                            <stripes:select name="bugs[${loop.index}]">
                                <stripes:option value="">Select One</stripes:option>
                                <stripes:options-collection collection="${componentManager.allComponents}"
                                                            label="name" value="id"/>
                            <stripes:select name="bugs[${loop.index}]">
                                <stripes:option value="">Select One</stripes:option>
                                <stripes:options-collection collection="${personManager.allPeople}"
                                                            label="username" value="id"/>
                            <stripes:select name="bugs[${loop.index}].priority">
                                <stripes:option value="">Select One</stripes:option>
                                <stripes:options-enumeration enum=""/>
                        <td><stripes:textarea name="bugs[${loop.index}].shortDescription"/></td>
                        <td><stripes:textarea name="bugs[${loop.index}].longDescription"/></td>

            <div class="buttons">
                <stripes:submit name="save" value="Save"/>
public class MultiBugActionBean extends BugzookyActionBean {
    /** Populated during bulk add/edit operations. */
        @Validate(field="shortDescription", required=true, maxlength=75),
        @Validate(field="longDescription", required=true, minlength=25),
        @Validate(field="", required=true),
        @Validate(field="", required=true),
        @Validate(field="priority", required=true)
    private List<Bug> bugs = new ArrayList<Bug>();

    /** Populated by the form submit on the way into bulk edit. */
    private int[] bugIds;

    /** Gets the array of bug IDs the user selected for edit. */
    public int[] getBugIds() { return bugIds; }

    /** Sets the array of bug IDs the user selected for edit. */
    public void setBugIds(int[] bugIds) { this.bugIds = bugIds; }

     * Simple getter that returns the List of Bugs.  Not the use of generics syntax - this is
     * necessary to let Stripes know what type of object to create and insert into the list.
    public List<Bug> getBugs() {
        return bugs;

    /** Setter for the list of bugs. */
    public void setBugs(List<Bug> bugs) {
        this.bugs = bugs;

    public Resolution save() {
        BugManager bm = new BugManager();

        for (Bug bug : bugs) {
            Bug newBug = populateBug(bug);

        return new RedirectResolution("/bugzooky/BugList.jsp");

    public Resolution preEdit() {
        if (this.bugIds == null) {
                new SimpleError("You must select at least one bug to edit.") );
            return getContext().getSourcePageResolution();

        BugManager bm = new BugManager();
        for (int id : this.bugIds) {
            this.bugs.add( bm.getBug(id) );

        return new RedirectResolution("/bugzooky/BulkAddEditBugs.jsp").flash(this);
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.