Search code examples
javatomcatweb.xmlstripes

Problem configuring my first Stripes project


apparently i'm having some technical problem configuring Stripes.

I use Eclipse ganymede and when i try to run my project from the main project or from the jsp i get a 404 error from Tomcat.

This is the structure of my project:

Web-content>Web-inf>lib>....jstl, commons.logging and stripes jars
Web-content>Web-inf>classes>StripesResources.properties
Web-content>Web-inf>classes>stripesbook>action>StripesTime.java
                                               (extends ActionBean)
Web-content>Web-inf>jsp>stripesTime.jsp
Web-content>Web-inf>lib>web.xml....which looks as follows:

web.xml: Stripes

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

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

  <filter-mapping>
    <filter-name>StripesFilter</filter-name>
    <servlet-name>DispatcherServlet</servlet-name>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
  </filter-mapping>

  <servlet-mapping>
    <servlet-name>DispatcherServlet</servlet-name>
    <url-pattern>*.action</url-pattern>
  </servlet-mapping>

  <welcome-file-list>
    <welcome-file>StripesTime.jsp</welcome-file>
  </welcome-file-list>
</web-app>

Apparently, jars are loaded correctly, the packages are in the right places "the stripes tutorial i'm following inserts the packages as folders under the web-inf rather then under the Java-Resources:src" I cant get why, even if i run the jsp file independently, tomcat wont find it. Any suggestions? Thank you!


Solution

  • The Stripes framework expects the names of action bean classes to end on either Action or Bean. Other class names are ignored, unless you configure Stripes to recognize them (see: NameBasedActionResolver).

    Thus if you change the name of the StripesTime class to StripesTimeAction it will be recognized by Stripes and mapped to the URL: "/StripesTime.action".

    Please see also: Stripes URL Bindings and event names