0

アプリケーションで struts1 ページを struts2 に移行しました。ただし、下位互換性のために、古いページの URL "/login.do" にアクセスできるようにする必要があります。

「login.do」URL を「login.action」にリダイレクト/マップするにはどうすればよいですか?

これはフィルター クラスを作成することで実現できると思いますが、このタスクには複雑すぎるように思われるため、そうしたくありません。web.xml、struts.xml、または struts-config.xml でそれを行う方法が必要です。

ベストアンサーの人にビールを(フェニックスで)買います。:)

4

1 に答える 1

1

アクション拡張を変更します。これはデフォルトstruts.propertiesからのものです:

### Used by the DefaultActionMapper
### You may provide a comma separated list, e.g. struts.action.extension=action,jnlp,do
### The blank extension allows you to match directory listings as well as pure action names
### without interfering with static resources, which can be specified as an empty string
### prior to a comma e.g. struts.action.extension=, or struts.action.extension=x,y,z,,
struts.action.extension=action,,

ただし、定数の XML 構成が推奨されるため、struts.xml.

また、実際のリダイレクトを回避しますが、そのためのフィルターは簡単です。

于 2012-06-06T00:19:07.103 に答える