配置我的第一个 Stripes 项目时出现问题

发布于 2024-10-18 14:40:51 字数 1947 浏览 1 评论 0原文

显然我在配置 Stripes 时遇到了一些技术问题。

我使用 Eclipse ganymede,当我尝试从主项目或 jsp 运行我的项目时,我从 Tomcat 收到 404 错误。

这是我的项目的结构:

Web-content>Web-inf>lib>....jstl, commons.logging and stripes jars
Web-content>Web-inf>classes>StripesResources.properties
Web-content>Web-inf>classes>stripesbook>action>StripesTime.java
                                               (extends ActionBean)
Web-content>Web-inf>jsp>stripesTime.jsp
Web-content>Web-inf>lib>web.xml....which looks as follows:

web.xml: Stripes

  <filter>
    <filter-name>Stripes Filter</filter-name>
    <filter-class>net.sourceforge.stripes.controller.StripesFilter</filter-class>
    <init-param>
      <param-name>ActionResolver.Packages</param-name>
      <param-value>stripesbook.action</param-value>
    </init-param>
  </filter>

  <servlet>
    <servlet-name>DispatcherServlet</servlet-name>
    <servlet-class>net.sourceforge.stripes.controller.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <filter-mapping>
    <filter-name>StripesFilter</filter-name>
    <servlet-name>DispatcherServlet</servlet-name>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
  </filter-mapping>

  <servlet-mapping>
    <servlet-name>DispatcherServlet</servlet-name>
    <url-pattern>*.action</url-pattern>
  </servlet-mapping>

  <welcome-file-list>
    <welcome-file>StripesTime.jsp</welcome-file>
  </welcome-file-list>
</web-app>

显然,jar 已正确加载,包位于正确的位置“我正在关注的 stripes 教程将包作为文件夹插入到 web-inf 下而不是 Java-Resources:src 下” 我不明白为什么,即使我独立运行jsp文件,tomcat也找不到它。 有什么建议吗? 谢谢你!

apparently i'm having some technical problem configuring Stripes.

I use Eclipse ganymede and when i try to run my project from the main project or from the jsp i get a 404 error from Tomcat.

This is the structure of my project:

Web-content>Web-inf>lib>....jstl, commons.logging and stripes jars
Web-content>Web-inf>classes>StripesResources.properties
Web-content>Web-inf>classes>stripesbook>action>StripesTime.java
                                               (extends ActionBean)
Web-content>Web-inf>jsp>stripesTime.jsp
Web-content>Web-inf>lib>web.xml....which looks as follows:

web.xml:
Stripes

  <filter>
    <filter-name>Stripes Filter</filter-name>
    <filter-class>net.sourceforge.stripes.controller.StripesFilter</filter-class>
    <init-param>
      <param-name>ActionResolver.Packages</param-name>
      <param-value>stripesbook.action</param-value>
    </init-param>
  </filter>

  <servlet>
    <servlet-name>DispatcherServlet</servlet-name>
    <servlet-class>net.sourceforge.stripes.controller.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <filter-mapping>
    <filter-name>StripesFilter</filter-name>
    <servlet-name>DispatcherServlet</servlet-name>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
  </filter-mapping>

  <servlet-mapping>
    <servlet-name>DispatcherServlet</servlet-name>
    <url-pattern>*.action</url-pattern>
  </servlet-mapping>

  <welcome-file-list>
    <welcome-file>StripesTime.jsp</welcome-file>
  </welcome-file-list>
</web-app>

Apparently, jars are loaded correctly, the packages are in the right places "the stripes tutorial i'm following inserts the packages as folders under the web-inf rather then under the Java-Resources:src"
I cant get why, even if i run the jsp file independently, tomcat wont find it.
Any suggestions?
Thank you!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

秋千易 2024-10-25 14:40:51

Stripes 框架期望操作 bean 类的名称以 Action 或 Bean 结尾。其他类名将被忽略,除非您将 Stripes 配置为识别它们(请参阅:NameBasedActionResolver)。

因此,如果您将 StripesTime 类的名称更改为 StripesTimeAction,Stripes 将会识别它并映射到 URL:“/StripesTime.action”。

另请参阅:Stripes URL 绑定和事件名称

The Stripes framework expects the names of action bean classes to end on either Action or Bean. Other class names are ignored, unless you configure Stripes to recognize them (see: NameBasedActionResolver).

Thus if you change the name of the StripesTime class to StripesTimeAction it will be recognized by Stripes and mapped to the URL: "/StripesTime.action".

Please see also: Stripes URL Bindings and event names

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文