配置我的第一个 Stripes 项目时出现问题
显然我在配置 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
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