新手求教,刚接触struts2,遇到配置的问题
RT,我用这样访问时提示找不到映像文件:http://localhost:8080/TestStruts/struts0.action下面是配置:
首先这是项目文件的位置:
struts.xml的配置:
web.xml的配置:
首先这是项目文件的位置:

struts.xml的配置:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<!-- <constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="true" />
<package name="default" namespace="/" extends="struts-default">
<default-action-ref name="index" />
<global-results>
<result name="error">/WEB-INF/jsp/error.jsp</result>
</global-results>
<global-exception-mappings>
<exception-mapping exception="java.lang.Exception" result="error"/>
</global-exception-mappings>
<action name="index">
<result type="redirectAction">
<param name="actionName">HelloWorld</param>
<param name="namespace">/example</param>
</result>
</action>
</package>
<include file="example.xml"/> -->
<!-- Add packages here -->
<package name="default" namespace="/" extends="struts-default">
<default-action-ref name="index" />
<global-results>
<result name="error">/WEB-INF/jsp/error.jsp</result>
</global-results>
<global-exception-mappings>
<exception-mapping exception="java.lang.Exception" result="error"/>
</global-exception-mappings>
<action name="struts0">
<result type="redirectAction">/struts0.jsp</result>
</action>
</package>
</struts>
web.xml的配置:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Struts Blank</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!-- Restricts access to pure JSP files - access available only via Struts action -->
<security-constraint>
<display-name>No direct JSP access</display-name>
<web-resource-collection>
<web-resource-name>No-JSP</web-resource-name>
<url-pattern>*.jsp</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>no-users</role-name>
</auth-constraint>
</security-constraint>
<security-role>
<description>Don't assign users to this role</description>
<role-name>no-users</role-name>
</security-role>
</web-app>
...全文
相关推荐
Struts2.5.2的配置及问题解决
Struts2.5.2是Apache Struts框架的一个版本,它是基于MVC设计模式的Java Web应用程序开发框架。本文将详细介绍Struts2.5.2的配置过程以及可能遇到的问题和解决方案。
eclipse 配置struts2
记得在开发过程中,利用IDE的错误提示和日志信息来定位和解决问题,同时也可以借助Struts2的官方文档和社区资源来深入学习和提升。
struts2.3.3运行配置
"本文档主要介绍如何配置并运行Struts2.3.3版本,特别针对新手在版本兼容性和类找不到的问题上提供解决方案。"Struts是一个流行的Java Web开发框架,遵循Model-View-Co
Struts2新手资料
总的来说,这套Struts2新手资料涵盖了从基础到进阶的多个方面,对想要学习和掌握Struts2框架的初学者来说是一份宝贵的资源。通过深入学习,你可以构建出高效、稳定且易于维护的Java Web应用。
Struts2框架初学接触
**配置文件**:Struts2允许开发者通过XML配置文件定义Action类、结果页面、拦截器链等。虽然Struts2鼓励减少硬编码配置,但它仍需要一些基本的配置来启动和运行。4.


