struts 1
来源:互联网 发布:鲁滨逊漂流记游戏java 编辑:程序博客网 时间:2024/06/09 22:21
- Struts 1 配置文件
Struts 1 应用的配置文件有两个分别是web.xml与struts-config.xml文件。其中,web.xml文件时配置所有Web应用的,而struts-config.xml文件时Struts 1专用配置为文件。
web.xml的文件配置
<?xml version="1.0" encoding="UTF-8"?><web-app xmlns="http://java.sun.com/xml/ns/javaee"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5"xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"><!-- 配置ActionServlet --><servlet><servlet-name>action</servlet-name><servlet-class>org.apache.struts.action.ActionServlet</servlet-class><init-param><param-name>config</param-name><param-value>/WEB-INF/struts-config.xml</param-value></init-param><init-param><param-name>debug</param-name><param-value>3</param-value></init-param><init-param><param-name>detail</param-name><param-value>3</param-value></init-param><load-on-startup>0</load-on-startup></servlet><!-- Servlet映射成.do为后缀的文件 --><servlet-mapping><servlet-name>action</servlet-name><url-pattern>*.do</url-pattern></servlet-mapping><welcome-file-list><welcome-file>index.jsp</welcome-file></welcome-file-list></web-app>
sturts-config.xml的文件配置
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN" "http://struts.apache.org/dtds/struts-config_1_3.dtd"><struts-config><!-- FormBean 本质上是javaBean,用来存储页面表单中各个域的值--><form-beans><form-bean name="customerForm" type="com.sanqing.struts.form.CustomerForm" /></form-beans><global-exceptions /><!-- 定义整个系统都可以使用的全局转向中转地址 --><global-forwards ></global-forwards><!-- web.xml文件中后缀为.do的用户请求被转到这里处理 --><action-mappings><action name="customerForm" input="/main.jsp"parameter="actionType" path="/customer" scope="request"type="org.springframework.web.struts.DelegatingActionProxy" /></action-mappings><message-resourcesparameter="com.sanqing.struts.action.ApplicationResources" /><!-- action交给spring去管理,这个是spring 的plug-in 的配置 --><plug-inclassName="org.springframework.web.struts.ContextLoaderPlugIn"><set-property property="contextConfigLocation"value="classpath:applicationContext.xml" /></plug-in></struts-config>
- Struts 1 处理过程
Web应用启动时加载并初始化ActionServlet,ActionServlet从struts-config.xml文件中读取配置信息,并把他们存放到各种配置对象中。启动后的应用处理过程如下。
(1) 通过客户端页面与用户进行交互, 将页面提交的数据封装到ActionForm中。
(2) 桶过请求路径查找struts-config.xml配置文件中Action的配置,找到并调用对应的Action.
(3) 在Action中调用业务逻辑方法处理用户的请求。
(4)查找ActionMapping,找到正确的jsp页面进行转发,返回给客户端。 0 0
- struts step 1 : struts ?
- struts(1)
- struts 1
- Struts 1 VS Struts 2
- Struts(1)初识Struts
- Struts Series(1) - Struts基础
- struts 1 和 struts 2区别,struts 2创建
- Struts 2 和Struts 1对比
- Struts 2和Struts 1的比较
- 接触struts--struts配置(1)
- Struts从零开始四、Struts中的国际化[1]
- struts 1 和struts 2的区别
- Struts 2和Struts 1的比较
- Struts 2与Struts 1的对比
- Struts 2和Struts 1的区别
- Struts 2与Struts 1的对比
- struts 2和struts 1区别
- Struts 2与Struts 1的对比
- jQuery中的Sizzle引擎分析
- success
- C++学习过程重点问题记录
- 第九、Java数组的常见操作(冒泡、选择排序、数组翻转)
- ACM习题L-12
- struts 1
- Java获取视频文件时长
- 非常简单好看的JQuery弹出层
- 两个链表中的第一个公共节点
- 【DayDayUp】【算法_图_网络流_之一_增广路】
- 一步一步搭框架(asp.netmvc+easyui+sqlserver)
- noi-1702-字符替换
- uboot下run_main_loop中main_loop实现
- 前端页面性能参数搜集