Stripes Framework

01 Dec


Stripes is an Open Source web application framework using MVC pattern. It aims to be very light weight, more lightweight than struts by using java technologies new framework annotations and generics that was introduced in Java1.5 . Every existing framework requires gobs of configuration Struts, MVC-Springs or Web Work2. Though all these framework are pretty much in use but wastes lots of time in serious architectural and configuratonal issues.

The normal flow of events and components that are typical for applications that are written with Stripes


Key Features:

  • Zero external configuration per page/action (ActionBeans are auto-discovered, and configured using annotations)
  • Powerful binding engine that will build complex object webs out of the request parameters
  • Easy to use (and localized) validation and type conversion system
  • Localization system that works even when you use direct JSP->JSP links
  • Ability to re-use ActionBeans as view helpers
  • Ridiculously easy to use indexed property support
  • Built in support for multiple events per form
  • Transparent file upload capabilities
  • Support for incremental development (e.g. you can build and test your JSP before even thinking about your ActionBean)
  • And a lot of built in flexibility that you only have to be aware of when you need to use it

Building first Stripes Action:

public class HelloWorldAction implements ActionBean {   


              @Validate(field = “firstName”, required = true, on = {“hello”}),

               @Validate(field = “age”, required = true, minvalue = 13, on ={“hello”})


             private Person person;

            private ActionBeanContext context;   


            public Resolution index() {

            return new ForwardResolution(“Hello.jsp”);


            public Resolution hello() {

            return new ForwardResolution(“SayHello.jsp”);


             public void setPerson(String person) {this.person = person;}

             public String getPerson() { return person;}

            public void setContext(ActionBeanContext c) {this.context = c; }

            public ActionBeanContext getContext() {return context; }


Understanding the Concept Behind:

The controller class resembles a POJO (Plain Old Java Object) that implements a Stripes-specific interface called ActionBean. All Stripes actions need to implement this interface to allow the StripesDispatcher servlet to inject an ActionBeanContext object into the current action being serviced. The ActionBeanContext object allows you to access servlet API objects such as the request, response, and servlet context. Most of the time it is not necessary to access these low-level API objects in a Stripes application. The ActionBeanContext class also allows you to get state information about the current action as well as add informational messages and error messages from the current action. The ActionBeanContext field and accessors can be stored in a base class since all Stripes actions will require this implementation.

The rest of the controller class should be familiar to any Java developer. There is a Person object with accessors that will be used to read and write our person’s first and last name to our views. While this is a simple nested object, Stripes allows more sophisticated data binding with Java collections, generics support, and indexed properties. Since Stripes can handle complex data binding, your domain objects can be reused in other layers that need them. For example, it is easy to collect information in a domain object via Stripes and make persistent changes with other POJO frameworks like Hibernate or EJB 3.

The view and the controller are also coded in the stripe way to make the world easier.

Stripes Over struts:

Number of artifacts: Struts is the fact that just to implement a single page/form, I have to write or edit so many files. And I have to keep them in sync, or else things start going horribly wrong. With Struts I have to write my JSP, my Action, my Form, a form-bean stanza in the struts-config.xml, an action stanza in the struts-config.xml, Compare this with Stripes. I write my JSP. I write my ActionBean and annotate it with a @UrlBinding to specify the URL it should respond to, and one or more @HandlesEvent annotations to map events to methods. I’m done. All the information about the form and the action is in the same place.

Incremental development: Write JSP, see if it looks ok, then go and write the back end components to go with it. And Stripes provides you this feature.

Property binding: Struts lets you use nested properties but stripes will instantiate everything.

Validation: In Stripes validation is tied closely to type conversion. A number of commonly used validations can be applied pre-conversion using a simple annotation. This includes things like required field checks, length checks, regex checking etc.

Multi-Event Actions: If you want to have a form that submits multiple different events in Struts you have to either extend the DispatchAction or write your own support for it. And since the DispatchAction requires all buttons to have the same name, and uses the value to determine the method to invoke, it’s a huge pain if you’re using localized or even just externalized values for your buttons.Stripes uses the name of the button itself, and has built in support for multi-event Actions. You can localize to your heart’s content, and Stripes will detect which button was pressed and invoke the right method for you.

JSP / View Helpers: Struts doesn’t really provide a good pattern for providing dynamic data to JSPs that are not the result of another Action. Stripes has a neat way of handling this. A custom tag allows the use of ActionBeans as view helpers. It works similarly to the jsp:useBean tag in that if the ActionBean alreadyexists it just gives you a reference to it. If it doesn’t exist, the tag will bring it into existence, bind data out of the request on to it, and get it ready for use.

“HTML” Tags : The Struts form input tags use ‘property’ instead of ‘name’? And why is it ‘styleClass’ instead of ‘class’? It also makes it hard to change a tag back and forth from a plain HTML tag to a Struts tag. Stripes takes pains to make all the form input tags as close to (if not identical to) their HTML counterparts as possible.

Goals of Stripes:

  • Make developing web applications in Java easy.
  • Provide simple yet powerful solutions to common problems
  • Make the Stripes ramp up time for a new developer less than 30 minutes
  • Make it really easy to extend Stripes, without making you configure every last thing.

Latest Version:

  •  Stripes1.5 is the latest version Released.




Posted by on December 1, 2008 in Web


Tags: , ,

2 responses to “Stripes Framework

  1. buna BC

    April 2, 2009 at 9:45 am

    I am beginner of stripes. The note is quite simple but useful too. Actually, how many files we need to build a basic/ simplest stripes application?

  2. Hilman Zaky

    June 5, 2009 at 4:01 am

    I already download stripes framework at
    but i get confused because the sites doesn’t provide a way to setting up project folder..
    like where should I put best of “stripes” directory on my project ? where should I put best of all jsp file ? where should I put best of all ActionBean file ?
    should I edit the examples for beginning my project ?


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: