首先是目录结构
[img]http://yunmanfan.iteye.com/upload/picture/pic/14515/a32a5778-0f01-3773-b4df-10ba883cb872.jpg [/img]
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app 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.cn/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
<!-- Action Servlet Configuration -->
<servlet>
<servlet-name>dispatcherServlet</servlet-name>
<servlet-class>
org.apache.struts.action.ActionServlet
</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>
/WEB-INF/structs-config.xml
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcherServlet</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
</web-app>
structs-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
<structs-config>
<!-- 定义formbean -->
<form-beans>
<form-bean name="helloworld" type="com.gc.action.HelloWorld"></form-bean>
</form-beans>
<action-mappings>
<action path="/helloworld" type="com.gc.action.HelloWorldAction" name="helloWorld">
<forward name="show" path="/WEB-INF/jsp/show.jsp"></forward>
</action>
<action path="/input" type="org.apache.structs.actions.ForwardAction" parameter="/WEB-INF/jsp/input.jsp">
</action>
</action-mappings>
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/config.xml"/>
</plug-in>
</structs-config>
config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="helloWorldService" class="com.gc.impl.HelloWorldServiceImpl"></bean>
</beans>
调试时出现的信息
HTTP Status 400 - Invalid path /input was requested
--------------------------------------------------------------------------------
type Status report
message Invalid path /input was requested
description The request sent by the client was syntactically incorrect (Invalid path /input was requested).
分享到:
相关推荐
struts1和struts2的区别struts1和struts2的区别struts1和struts2的区别struts1和struts2的区别struts1和struts2的区别struts1和struts2的区别struts1和struts2的区别struts1和struts2的区别struts1和struts2的区别...
struts例子struts例子struts例子struts例子struts例子struts例子struts例子struts例子struts例子struts例子struts例子struts例子struts例子struts例子struts例子
struts中文乱码问题解决详细步骤(两种方法)
struts包struts包struts包struts包struts包struts包struts包struts包
经典的struts中文问题,国际化问题终极解决方案
struts上传struts上传 struts上传struts上传
struts练习struts练习struts练习
一个很好的关于Struts2的讲义!struts2讲义struts2讲义struts2讲义struts2讲义struts2讲义struts2讲义
struts源码struts源码struts源码struts源码
struts文件上传大小限制问题struts文件上传大小限制问题struts文件上传大小限制问题struts文件上传大小限制问题
Struts 1的一个具体问题是使用抽象类编程而不是接口。Struts 2 Action类可以实现一个Action接口,也可以实现其他接口,使可选和定制的服务成为可能。Struts 2提供一个ActionSupport基类去实现常用的接口。即使Action...
struts 翻译struts 翻译struts 翻译struts 翻译struts 翻译
配置Struts配置Struts配置Struts配置Struts配置Struts配置Struts
Struts1的一个普遍问题是使用抽象类编程而不是接口。 ◆Struts 2 Action类可以实现一个Action接口,也可实现其他接口,使可选和定制的服务成为可能。Struts2提供一个ActionSupport基类去实现 常用的接口。Action...
Struts2是一套非常优秀的Java WEB应用框架,实现优雅、功能强大、使用简洁。目前已有大量的企业项目采用Struts2来作为Web框架进行开发,掌握Struts2是每个进行Web开发的Java程序员的一项必备技能。 本视频对Struts2...
Struts简介 什么是Struts Struts基本运作流程 ActionMapping类 Action类 ActionForm类 ActionError与ActionMessage 协同开发 模块化程序 Struts异常处理 Struts国际化支持 PlugIn接口 等等
Struts 2是Struts的下一代产品,是在 struts 和WebWork的技术基础上进行了合并的全新的Struts 2框架。其全新的Struts 2的体系结构与Struts 1的体系结构的差别巨大。Struts 2以WebWork为核心,采用拦截器的机制来处理...
struts2.1.6 解决日历问题。区别struts2.0
struts-config.xml struts标准配置文件 struts-config
北京时间8月22日13时,Apache官方发布通告公布了Struts2中一个远程代码执行漏洞(cve-2018-11776)。该漏洞可能在两种情况下被触发,第一,当没有为底层xml配置中定义的结果设置namespace 值,并且其上层动作集配置...