I am working through Fred Daoud's Stripes book and trying to convert the Hello World application to use friendly URLs, as I'm not a big fan of suffix-based mappings like http://localhost:8080/getting_started/Hello.action.
Here is the before ...
index.jsp:
<jsp:forward page="/Hello.action"/>
web.xml:
<servlet-mapping>
<servlet-name>DispatcherServlet</servlet-name>
<url-pattern>*.action</url-pattern>
</servlet-mapping>
and I have no UrlBinding on my HelloActionBean. I have the book example working.
I'm wondering if the book examples may suit an earlier version of Stripes, as I've downloaded 1.5.1 and my web.xml defines the StripesFilter and StripesDispatcher whereas I've seen a DynamicMappingFilter used elsewhere, e.g. in this article by Fred on TheServerSide.
Anyway, I made the following changes:
index.jsp:
<jsp:forward page="/hello"/>
web.xml:
<servlet-mapping>
<servlet-name>DispatcherServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
HelloActionBean.java:
**@UrlBinding("/hello")**
public class HelloActionBean implements ActionBean
{
However, when I try to load the app through http://localhost:8080/getting_started I see this:
net.sourceforge.stripes.exception.ActionBeanNotFoundException: Could not locate an ActionBean that is bound to the URL [/]. Commons reasons for this include mis-matched URLs and forgetting to implement ActionBean in your class. Registered ActionBeans are: {/hello=class stripesbook.action.HelloActionBean, /controller/DefaultView.action=class net.sourceforge.stripes.controller.DefaultViewActionBean, /hello/=class stripesbook.action.HelloActionBean, /controller/DefaultView.action/=class net.sourceforge.stripes.controller.DefaultViewActionBean}
at net.sourceforge.stripes.controller.AnnotatedClassActionResolver.getActionBean(AnnotatedClassActionResolver.java:341)
and if I access it through http://localhost:8080/getting_started/hello the server seems to go into a loop throwing one exception after another.
Any suggestions appreciated - thanks.