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.

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="header.jsp" %>

<div class="sectionTitle">Bulk Add</div>

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

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

    <table class="display">
            <th>Short Description</th>
            <th>Long Description:</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=""/>
                    <stripes:select name="bugs[${loop.index}].status">
                        <stripes:option value="">Select One</stripes:option>
                        <stripes:options-enumeration enum=""/>
                <td><stripes:textarea cols="25" rows="3" name="bugs[${loop.index}].shortDescription"/></td>
                <td><stripes:textarea cols="25" rows="3" name="bugs[${loop.index}].longDescription"/></td>

    <div class="buttons">
        <stripes:submit name="SaveOrUpdate" value="Save"/>
<%@ include file="footer.jsp" %>
public class MultiBugActionBean extends BugzookyActionBean {
    /** Populated during bulk add/edit operations. */
    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; }

        @Validate(field="shortDescription", required=true, maxlength=75),
        @Validate(field="longDescription", required=true, minlength=25),
        @Validate(field="", required=true),
        @Validate(field="", required=true),
        @Validate(field="status", required=true),
        @Validate(field="priority", required=true)
    public List<Bug> getBugs() {
        return bugs;

    public void setBugs(List<Bug> bugs) {
        this.bugs = bugs;

    public Resolution saveOrUpdate() {
        BugManager bm = new BugManager();
        PersonManager pm = new PersonManager();
        ComponentManager cm = new ComponentManager();

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

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

    public Resolution preBulkEdit() {
        // If the user didn't select any bugs to edit, bad user.
        if (this.bugIds == null || this.bugIds.length < 1) {            
            ValidationErrors errors = new ValidationErrors();
            errors.add( 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 ForwardResolution("/bugzooky/BulkAddEditBugs.jsp");
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.