• HOME
  • EMAIL US
  • 1.800.975.6814

@dailyrazor Blog

Oct
19
2012

Stripes Hosting – How To Configure Stripes Framework

Posted BY: Web Master | Comment: | Category:

Stripes is a presentation framework for building web applications using the latest Java technologies. The main driver behind Stripes is that web application development in Java is just too much work! It seems like every existing framework requires gobs of configuration. Struts is pretty feature-light and has some serious architectural issues. Others, like WebWork 2 and Spring-MVC are much better, but still require a lot of configuration, and seem to require you to learn a whole new language just to get started. DailyRazor is a leading java hosting provider for Stripes hosting. Stripes framework is supported and can be hosted on our Private Tomcat java hosting plans.

stripes hosting

How to Deploy Stripes hosting on DailyRazor Servers:

Requirements:

  • Java 5 or above
  • Tomcat 5.5 or above

Steps for Private Tomcat plan owners:

  • 1. Open Stripes download page – http://www.stripesframework.org/display/stripes/Download Choose latest version and download binary distribution of “stripes-.zip” to your local computer.
  • 2. Unpack downloaded file.
  • 3. Upload all jar libraries from lib/ subfolder under the folder where the archive was unpacked to, to Tomcat’s shared lib folder – /home/_username_/tomcat/shared/lib/ (where _username_ is name of your account on the server).
  • 4. After uploading all the files to Tomcat’s, please restart your Tomcat so it loads the libraries.
  • 5. Configure Stripes for your application (described below) and upload the application to the server, and Tomcat will deploy it automatically. You don’t need to include the libraries to application itself, Tomcat will share them for all the applications you Tomcat running.
  • Steps for Shared Tomcat plan owners:

    • 1. Open Stripes download page – http://www.stripesframework.org/display/stripes/Download Choose latest version and download binary distribution of “stripes-.zip” to your local computer.
    • 2. Unpack downloaded file.
    • 3. Upload all jar libraries from lib/ subfolder under the folder where the archive was unpacked to, to application lib folder (WEB-INF/lib) on the local machine.
    • 4. In case if you prefer to use applications in .war format, repack updated application.
    • 5. Remove the application (war or folder with unpacked application) from the server, so Tomcat will undeploy it.
    • 6. Upload the application to the server, so the Tomcat will automatically deploy it. Please note, you need to configure Stripes first, please check how to do this below.

    Configuring Stripes:

    • 1. You simply need to configure the Stripes Filter with a parameter and the Stripes Dispatcher Servlet in your web application’s web.xml. A pretty standard configuration would look like this:

    <?xml version=”1.0″ encoding=”UTF-8″?>

    <web-app xmlns=”http://java.sun.com/xml/ns/j2ee”
    xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
    xsi:schemaLocation=”http://java.sun.com/xml/ns/j2ee
    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd”
    version=”2.4″>

    <filter>
    <display-name>Stripes Filter</display-name>
    <filter-name>StripesFilter</filter-name>
    <filter-class>net.sourceforge.stripes.controller.StripesFilter</filter-class>
    <init-param>
    <param-name>ActionResolver.Packages</param-name>
    <param-value>net.sourceforge.stripes.examples</param-value>
    </init-param>
    </filter>

    <filter-mapping>
    <filter-name>StripesFilter</filter-name>
    <url-pattern>*.jsp</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    </filter-mapping>

    <filter-mapping>
    <filter-name>StripesFilter</filter-name>
    <servlet-name>StripesDispatcher</servlet-name>
    <dispatcher>REQUEST</dispatcher>
    </filter-mapping>

    <servlet>
    <servlet-name>StripesDispatcher</servlet-name>
    <servlet-class>net.sourceforge.stripes.controller.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
    <servlet-name>StripesDispatcher</servlet-name>
    <url-pattern>*.action</url-pattern>
    </servlet-mapping>
    </web-app>

    !!!The ActionResolver.Packages parameter!!!
    Stripes auto-discovers your ActionBeans at deployment time by scanning your web application’s classpath. This saves you from having to enumerate all your ActionBeans somewhere, but you do have to give Stripes some starting points. To do so, use the ActionResolver.Packages init-param of the Stripes Filter to indicate one or more package roots. Do not use .* at the end of a package; subpackages are automatically included. Use commas to separate multiple package roots. The ActionResolver.Packages is the only required init-param for the Stripes Filter.

    • 2. Now you need to put in place the StripesResources.properties from lib/ subfolder under the folder where the archive was unpacked to – you’ll need to copy that to your web application’s /WEB-INF/classes. StripesResources.properties is used to lookup error messages both for Stripes’ built in validations, and for any validation done in ActionBeans, and it has to be available in the Classpath. An example fragment of the file follows:

    Example StripesResources.properties

    # Validation error messages used by Stripes’ built in type converters
    converter.number.invalidNumber=The value ({1}) entered in field {0} must be a valid number
    converter.byte.outOfRange=The value ({1}) entered in field {0} was out of the range {2} to {3}
    converter.short.outOfRange=The value ({1}) entered in field {0} was out of the range {2} to {3}
    converter.integer.outOfRange=The value ({1}) entered in field {0} was out of the range {2} to {3}
    converter.float.outOfRange=The value ({1}) entered in field {0} was out of the range {2} to {3}
    converter.enum.notAnEnumeratedValue=The value “{1}” is not a valid value for field {0}
    converter.date.invalidDate=The value ({1}) entered in field {0} must be a valid date
    converter.email.invalidEmail=The value ({1}) entered is not a valid email address

    • 3. Redeploy your application with new Stripes configuration.

    Official documentation: http://www.stripesframework.org/display/stripes/Documentation

    Visit here to review our hosting plans supporting Stripes Framework. If you need any assistance with configuring Stripe Frameworks on any of our Java hosting plans – please email us at support@dailyrazor.com or click here to open a support ticket.