2009-06-23 8 views
0

私はまだ初心者ですが、カスタムエラーページを実装する方法がわかりません。Struts/Spring with Tilesエラーページ

私はタイルを使用していますが、このプロジェクトではstruts2とSpringのフレームワークが混在していると思います。

私は私のweb.xmlに基本的なものをした:

<error-page> 
    <error-code>404</error-code> 
    <location>/WEB-INF/jsps/404error.jsp</location> 
</error-page> 

は完璧な作品 - そう長くIハードコードタイルのすべての部分とは、国際化を使用していないよう。できるだけ早く私は置くとして:

<s:text name="404.error.title" /> 

それを取得エラー:

The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - [unknown location]

サーブレット?サーブレットはありません.100 +のコードの中にあるものがあります。 多くのstruts.xmlとappContext.xmlがあります。私は何をすべきか分からない。

そして私はすべてのjspにerrorpageタグを入れたくありません。

実際、アクション/タイルページに誘導するサイト全体のエラーページを作成する方法があるかどうかを知りたいだけです。上の<エラーページ>コードのように。

ありがとうございます。

答えて

0

web.xmlにStruts2 FilterDispatcherを設定する必要があります。設定例は次のとおりです。

<filter> 
    <filter-name>struts2</filter-name> 
    <filter-class> 
     org.apache.struts2.dispatcher.FilterDispatcher 
    </filter-class> 
</filter> 

<filter-mapping> 
    <filter-name>struts2</filter-name> 
    <url-pattern>/*</url-pattern> 
</filter-mapping> 
+0

ありがとうございます。私は既存のフィルタのトンの違いを認識していない... –

+0

喜んでそれが助け!これはあなたのために働いた場合は、他の人がこれが正しいと知って、それを検索することができますので、質問を受け入れる/閉じてください。 –

+0

ええと...実際に私はそれがうまくいくかどうか判断するには速すぎました... struts2フィルタとstruts2フィルタの両方を使用してみましたが効果がないようです。 Struts2の-古い <フィルタクラス> org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter それでも同じサーブレットエラー...また –