私はhttp://localhost:8080/getting_started/Hello.actionのような接尾辞ベースのマッピングがあまり好きではないので、Fred Daoud の Stripes book に取り組んでいて、Hello World アプリケーションをわかりやすい URL を使用するように変換しようとしています。
こちらが前...
index.jsp:
<jsp:forward page="/Hello.action"/>
web.xml:
<servlet-mapping>
<servlet-name>DispatcherServlet</servlet-name>
<url-pattern>*.action</url-pattern>
</servlet-mapping>
そして、HelloActionBean に UrlBinding がありません。本の例が機能しています。
私は 1.5.1 をダウンロードし、私の web.xml は StripesFilter と StripesDispatcher を定義しているので、本の例が以前のバージョンの Stripes に適しているかどうか疑問に思っています。サーバー側で。
とにかく、私は次の変更を加えました:
index.jsp:
<jsp:forward page="/hello"/>
web.xml:
<servlet-mapping>
<servlet-name>DispatcherServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
HelloActionBean.java:
**@UrlBinding("/hello")**
public class HelloActionBean implements ActionBean
{
ただし、 http://localhost:8080/getting_startedからアプリをロードしようとすると、次のように表示されます。
net.sourceforge.stripes.exception.ActionBeanNotFoundException: Could not locate an ActionBean that is bound to the URL [/]. Commons reasons for this include mis-matched URLs and forgetting to implement ActionBean in your class. Registered ActionBeans are: {/hello=class stripesbook.action.HelloActionBean, /controller/DefaultView.action=class net.sourceforge.stripes.controller.DefaultViewActionBean, /hello/=class stripesbook.action.HelloActionBean, /controller/DefaultView.action/=class net.sourceforge.stripes.controller.DefaultViewActionBean}
at net.sourceforge.stripes.controller.AnnotatedClassActionResolver.getActionBean(AnnotatedClassActionResolver.java:341)
http://localhost:8080/getting_started/helloからアクセスすると、サーバーはループに陥り、次々と例外がスローされるようです。
任意の提案をいただければ幸いです - ありがとう。