1

I'm working on a Struts 2 application and I want to execute an action (in fact I'm interested more on executing an interceptor) instead of simply showing a welcome file. What is the best way to achieve this?

Thanks in advance!

Roman C
  • 49,761
  • 33
  • 66
  • 176
Rui
  • 5,900
  • 10
  • 38
  • 56

2 Answers2

1

Either redirect to the action from the welcome file, or use the action URL as a welcome file entry.

To do the latter, you'll likely need to set dispatcher elements on the element:

<filter-mapping>
    <dispatcher>REQUEST</dispatcher>
    etc.

Add FORWARD, INCLUDE, and ERROR as well, and the normal filter name/url.

Dave Newton
  • 158,873
  • 26
  • 254
  • 302
  • Can you be a little more explicit with that second option using web.xml? Thanks. – Rui Nov 09 '11 at 23:59
0

You have two well defined option both have been mentioned by Dave in his post.he has already described the Dispatcher option and other is to use redirection something like

<head>
    <META HTTP-EQUIV="Refresh" CONTENT="0;URL=example/MyAction.action">
</head>
Umesh Awasthi
  • 23,407
  • 37
  • 132
  • 204