01: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="h…
struts几个配置文件加载顺序: 01:struts-default.xml 02:struts-plugin.xml 03:struts.xml 04:struts.properties 05:web.xml 常量定义在这几个文件中, 同一个常量,定义在多个文件中会被覆盖…
课时7 为Action的属性注入值(增加灵活性,适用于经常更改的参数) Struts2为Action中的属性提供了依赖注入功能,在struts2的配置文件中,我们可以很方便地为Action中的属性注入值.注意:属性必须提供setter方法. <action name="list" class="tutorial.HelloWorld" method="other"> <param name="save">…
Struts2为Action中的属性提供了依赖注入功能,在struts2的配置文件里,能够为Action中的属性注入值,属性必须提供setter方法. 1)employeeAction类: public class employeeAction { private String savePath; public String getSavePath() { return savePath; } public void setSavePath(String savePath) { this.sav…
### 1. Spring IoC IoC:Inversion of control:控制反转:在传统开发模式下,对象的创建过程和管理过程都是由开发者通过Java程序来实现的,操作权在开发者的Java程序中,当使用了Spring框架后,对象的创建与管理都不再由开发者编写的程序来决定!而是交给框架来决定,具体的做法可以是通过配置框架的XML文件来实现,或其它方式. DI:Dependency Injection:依赖注入:为类的属性注入值. IoC是Spring框架所实现的目标,而DI是实现该目标…
概述 struts2为Action中的属性提供了依赖注入功能 在struts2的配置文件中,我们可以很方便地为Action中的属性注入值.注意:属性必须提供get,set方法. 配置 <action name="helloworld" class="com.liuyong666.action.HelloWorldAction"> <param name="savePath">/resource</param>…
1.掌握spring的属性注入的方法: 1.1构造方法注入普通值---------<constructor-arg>标签的使用 首先新建一个类 package spring.day1.demo3; public class car { private String name; private double price; public car(String name, Double price) { this.name = name; this.price = price; } @Overrid…
1.redirect:action处理完后重定向到一个视图资源(如:jsp页面),请求参数全部丢失,action处理结果也全部丢失.  2.redirectAction:action处理完后重定向到一个action,请求参数全部丢失,action处理结果也全部丢失.  3.chain:action处理完后转发到一个action,请求参数全部丢失,action处理结果不会丢失. redirectAction Result:     这个Result使用ActionMapperFactory提供的A…
项目中用到需要初始化一些数据,Spring提供了filed的值注入和method的返回值注入. 一.Field值的注入 filed值注入需要使用org.springframework.beans.factory.config.FieldRetrievingFactoryBean来获取类的静态变量. 例如,我们通常在接口中定义常量: Java代码   package com.wy.inject; /** * * @author wy * */ public interface Fruit { pu…
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <!-- act…