In some containers, setting welcome-file to a Struts 2 action will not work. Tomcat (for instance) checks the file system for a resource that matches the request before passing it off to the filter. This sort of makes it a pain...
There are two ways to deal with it (this goes for both the main entry point to your app, and for requests that reference directory names [http://yourhost/somedir/]). The first is to have a zero-length file that matches the request name. To me this is a hack, but it works. In the case of tomcat, you can have a file called index.action with no contents, and when requests for http://yourhost/contextroot/somedir/ come in, Tomcat will check that a file exists called index.action (if you have index.action mapped as a welcome-file), then it will continue with request processing. At which point, the struts filter will pick it up and serve the action mapped to index.action. The better method is to have an index.html file that simply redirects to the file you want to use. The example Struts 2 applications all use this method. This means you might incur a "Loading" page while the requests are redirected to an action, but this approach is the easiest to follow. -Wes -- Wes Wannemacher Author - Struts 2 In Practice Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more http://www.manning.com/wannemacher On Fri, 2009-01-16 at 14:12 -0700, Stanley, Eric wrote: > So if you use the default-action-ref, what do you put in the web.xml? > Can you leave it empty? > > -Ryan > > -----Original Message----- > From: Adam Lister [mailto:alis...@mit.edu] > Sent: Friday, January 16, 2009 1:59 PM > To: Struts Users Mailing List > Subject: Re: application entry point > > You can use default action mappings and wildcard mappings to go to a > specific action by default. > > Easiest way seems to be something like: > > <default-action-ref name="MyEntryAction"> > > In your struts.xml. > > It's detailed here: > http://struts.apache.org/2.0.14/docs/action-configuration.html#ActionCon > figuration-ActionDefault > > > > Andy wrote: > > What is the recommended design for adding an entry point into a > Struts2 application instead of using <welcome-file> in web.xml? > > > > > > _________________________________________________________________ > > Windows Live(tm) Hotmail(r): Chat. Store. Share. Do more with mail. > > http://windowslive.com/howitworks?ocid=TXT_TAGLM_WL_t1_hm_justgotbette > > r_howitworks_012009 > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > > This communication is the property of Qwest and may contain confidential or > privileged information. Unauthorized use of this communication is strictly > prohibited and may be unlawful. If you have received this communication > in error, please immediately notify the sender by reply e-mail and destroy > all copies of the communication and any attachments. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org