简体   繁体   中英

How do I use a Stripes action as my web app's welcome file?

I have an action bean named HomeActionBean, which Stripes has bound to the URL "Home.action". The URL binding works. Now I would like to use "Home.action" as my welcome file, like this:

<welcome-file-list>
  <welcome-file>Home.action</welcome-file>
</welcome-file-list>

This does not work with the default configuration from the Stripes quickstart guide. I get the error

A request made it through to some part of Stripes without being wrapped in a StripesRequestWrapper. [...]

I figured out that I can make it work if I add the line

<dispatcher>FORWARD</dispatcher>

to my web.xml like this:

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

My question is: Is this the appropriate way of using a Stripes action as a welcome file? Does adding that line with "FORWARD" in it to my web.xml have other, possibly unwanted consequences?

To bind an action bean to the homepage URL you should use: @UrlBinding("/") like this:

@UrlBinding("/")
public class HomepageAction {
   // .. action bean code..
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM