SSH整合注解释_注的含义

SSH整合注解释_注的含义架包pom.xml<projectxmlns=”http://maven.apache.org/POM/4.0.0″ xmlns:xsi=”http://www.w3.org/2001/XMLSchema-ins

SSH整合注解释_注的含义                                     SSH整合注解释_注的含义              

架包   pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.zking</groupId>
	<artifactId>hibernate-struts-xm</artifactId>
	<packaging>war</packaging> 
	<version>0.0.1-SNAPSHOT</version>
	<name>hibernate-struts-xm Maven Webapp</name>
	<url>http://maven.apache.org</url>

	<properties>
		<servlet-version>4.0.0</servlet-version>
		<Mysql-version>5.1.44</Mysql-version>
		<hibernate-version>5.2.10.Final</hibernate-version>
		<c3p0-version>0.9.5.2</c3p0-version>
		<spring-version>4.3.13.RELEASE</spring-version>
		<struts-version>2.5.16</struts-version>
		<fastjson-version>1.2.47</fastjson-version>
	</properties>


	<dependencies>

		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.12</version>
			<scope>test</scope>
		</dependency>


		<dependency>
			<groupId>com.alibaba</groupId>
			<artifactId>fastjson</artifactId>
			<version>${fastjson-version}</version>
		</dependency>


		<!-- servlet的依赖 -->
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>javax.servlet-api</artifactId>
			<version>${servlet-version}</version>
			<scope>provided</scope>
		</dependency>

		<!-- Mysql的依赖 -->
		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<version>${Mysql-version}</version>
		</dependency>
		<!-- hibernate的依赖 -->
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-core</artifactId>
			<version>5.2.10.Final</version>
		</dependency>
		<!-- c3p0的依赖 -->
		<dependency>
			<groupId>com.mchange</groupId>
			<artifactId>c3p0</artifactId>
			<version>${c3p0-version}</version>
		</dependency>

		<!-- struts2的依赖 -->
		<dependency>
			<groupId>org.apache.struts</groupId>
			<artifactId>struts2-core</artifactId>
			<version>${struts-version}</version>
		</dependency>


		<!-- spring的依赖 -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
			<version>${spring-version}</version>
		</dependency>
		<!-- spring-orm的依赖 -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-orm</artifactId>
			<version>${spring-version}</version>
		</dependency>
		<!-- spring-aspects的依赖 -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-aspects</artifactId>
			<version>4.3.13.RELEASE</version>
		</dependency>


		<!-- struts2-spring的依赖 -->
		<dependency>
			<groupId>org.apache.struts</groupId>
			<artifactId>struts2-spring-plugin</artifactId>
			<version>${struts-version}</version>
		</dependency>

		<!-- 引入struts2的注解式 -->
		<dependency>
			<groupId>org.apache.struts</groupId>
			<artifactId>struts2-convention-plugin</artifactId>
			<version>${struts-version}</version>
		</dependency>



	</dependencies>
	<build>
		<finalName>hibernate-struts-xm</finalName>
	</build>
</project>

pojo:实体类

@Entity
@Table(name = “t_fwxx”)

@Id
    @GenericGenerator(name = “myid”, strategy = “guid”)
    @GeneratedValue(generator = “myid”)

    @Column(name = “属性名”)

dao:方法类

@Repository(“ixd”) // 创建一个UserDaoImpl的bean对象

@Resource(name = “sessionFactoryBean”) // 引用sessionFactoryBean的bean对象
private SessionFactory sessionFactory;

service:实现类

@Repository(“ixs”) // 创建一个UserServiceImpl的bean对象
@Resource(name = “ixd”) // 引用UserDaoImpl的bean对象
private FwxxDao ixd;

action: Action

@Scope(value = “prototype”) // 产生一个新的Bean实例
@ParentPackage(“struts-default”)

@Resource(name = “ixs”) // 引用IUserService的bean对象

@Action(value = “findAlllistMyFwxxAction”, results = { @Result(name = “success”, location = “/index.jsp”),
            @Result(name = “error”, location = “/404.jsp”) })

具体如下: 

package com.zking.pojo;
 
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

/**
 * 
 * @ClassName: Fwxx
 * @Description: t_fwxx表
 * @author LJY
 * @date 2018年9月12日 上午11:59:07
 *
 */
@Entity
@Table(name = "t_fwxx")
public class Fwxx {

	@Id
	@GenericGenerator(name = "myid", strategy = "guid")
	@GeneratedValue(generator = "myid")
	private String fwbh;
	@Column(name = "bt")
	private String bt;
	@Column(name = "dz")
	private String dz;
	@Column(name = "zj")
	private int zj;
	@Column(name = "lxr")
	private String lxr;
	@Column(name = "lxdh")
	private String lxdh;
	@Column(name = "lxbh")
	private String lxbh;
	@Column(name = "zxqk")
	private int zxqk;
	@Column(name = "szlc")
	private int szlc;
	@Column(name = "fwcx")
	private int fwcx;
	@Column(name = "bz")
	private String bz;
	@Column(name = "yhbh")
	private String yhbh;
	@Column(name = "fbrq")
	private String fbrq;

	public Fwxx() {
		super();
	}

	public Fwxx(String fwbh, String bt, String dz, int zj, String lxr, String lxdh, String lxbh, int zxqk, int szlc,
			int fwcx, String bz, String yhbh, String fbrq) {
		super();
		this.fwbh = fwbh;
		this.bt = bt;
		this.dz = dz;
		this.zj = zj;
		this.lxr = lxr;
		this.lxdh = lxdh;
		this.lxbh = lxbh;
		this.zxqk = zxqk;
		this.szlc = szlc;
		this.fwcx = fwcx;
		this.bz = bz;
		this.yhbh = yhbh;
		this.fbrq = fbrq;
	}

	public String getFwbh() {
		return fwbh;
	}

	public void setFwbh(String fwbh) {
		this.fwbh = fwbh;
	}

	public String getBt() {
		return bt;
	}

	public void setBt(String bt) {
		this.bt = bt;
	}

	public String getDz() {
		return dz;
	}

	public void setDz(String dz) {
		this.dz = dz;
	}

	public int getZj() {
		return zj;
	}

	public void setZj(int zj) {
		this.zj = zj;
	}

	public String getLxr() {
		return lxr;
	}

	public void setLxr(String lxr) {
		this.lxr = lxr;
	}

	public String getLxdh() {
		return lxdh;
	}

	public void setLxdh(String lxdh) {
		this.lxdh = lxdh;
	}

	public String getLxbh() {
		return lxbh;
	}

	public void setLxbh(String lxbh) {
		this.lxbh = lxbh;
	}

	public int getZxqk() {
		return zxqk;
	}

	public void setZxqk(int zxqk) {
		this.zxqk = zxqk;
	}

	public int getSzlc() {
		return szlc;
	}

	public void setSzlc(int szlc) {
		this.szlc = szlc;
	}

	public int getFwcx() {
		return fwcx;
	}

	public void setFwcx(int fwcx) {
		this.fwcx = fwcx;
	}

	public String getBz() {
		return bz;
	}

	public void setBz(String bz) {
		this.bz = bz;
	}

	public String getYhbh() {
		return yhbh;
	}

	public void setYhbh(String yhbh) {
		this.yhbh = yhbh;
	}

	public String getFbrq() {
		return fbrq;
	}

	public void setFbrq(String fbrq) {
		this.fbrq = fbrq;
	}

	@Override
	public String toString() {
		return "Fwxx [fwbh=" + fwbh + ", bt=" + bt + ", dz=" + dz + ", zj=" + zj + ", lxr=" + lxr + ", lxdh=" + lxdh
				+ ", lxbh=" + lxbh + ", zxqk=" + zxqk + ", szlc=" + szlc + ", fwcx=" + fwcx + ", bz=" + bz + ", yhbh="
				+ yhbh + ", fbrq=" + fbrq + "]";
	}

}
package com.zking.dao;

import java.util.List;

import com.zking.pojo.Fwxx;

public interface FwxxDao {

	public List<Fwxx> findFwxx(String bt, String lxbh, int zj);

	// 管理我的房租信息
	public List<Fwxx> findFwxx(String yhbh);

	// 详情
	public Fwxx findFwxxXq(String fwbh);

	// 管理我的房租信息根据用户名绑定
	public List<Fwxx> findByyhbh();

	// 管理我的房租信息
	public Fwxx findBiId();

	public long addFwxx(Fwxx fwxx);

	public long editFwxx(Fwxx fwxx);

	public long removeFwxx(String fwbh);
}

 

package com.zking.dao.impl;
 
 
import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;
import org.hibernate.SessionFactory;
import org.springframework.stereotype.Repository;
 
import com.zking.dao.FwxxDao;
import com.zking.pojo.Fwxx; 
 



@Repository("ixd") // 创建一个UserDaoImpl的bean对象
public class FwxxDaoImpl implements FwxxDao {

	@Resource(name = "sessionFactoryBean") // 引用sessionFactoryBean的bean对象
	private SessionFactory sessionFactory;

	public SessionFactory getSessionFactory() {
		return sessionFactory;
	}

	public void setSessionFactory(SessionFactory sessionFactory) {
		this.sessionFactory = sessionFactory;
	}

	// 查询
	@Override
	public List<Fwxx> findFwxx(String bt, String lxbh, int zj) {
		HttpServletRequest request = ServletActionContext.getRequest();
		String zj1 = request.getParameter("zj1");
		String zj2 = request.getParameter("zj2");
		String bt1 = request.getParameter("bt1");
		String lxbh1 = request.getParameter("lxbh1");
		StringBuffer sb = new StringBuffer();
		sb.append(" from Fwxx where 1=1 ");
		if (bt1 != null && bt1 != "") {
			sb.append(" AND bt like '%" + bt1 + "%'");
		}
		if (lxbh1 != null && lxbh1 != "") {
			sb.append(" AND lxbh = '" + lxbh1 + "' ");
		}
		if (zj1 != null && zj1 != "") {
			sb.append(" AND zj >" + zj1);
		}
		if (zj2 != null && zj2 != "") {
			sb.append(" AND zj <" + zj2);
		}
		List<Fwxx> listmyfwxx = sessionFactory.getCurrentSession().createQuery(sb.toString()).list();
		if (listmyfwxx.size() > 0) {
			return listmyfwxx;
		}
		return null;
	}

	@Override
	public List<Fwxx> findFwxx(String yhbh) {
		return null;
	}

	/**
	 * 详情邦值
	 */
	@Override
	public Fwxx findFwxxXq(String fwbh) {
		Fwxx flist = sessionFactory.getCurrentSession().get(Fwxx.class, fwbh);
		if (flist != null) {
			return flist;
		}
		return null;
	}

	/**
	 * 增加
	 */
	@Override
	public long addFwxx(Fwxx fwxx) {
		try {
			sessionFactory.getCurrentSession().save(fwxx);
			return 1;
		} catch (Exception e) {
			return 0;
		}

	}

	/**
	 * 修改
	 */
	@Override
	public long editFwxx(Fwxx fwxx) {
		try {
			sessionFactory.getCurrentSession().update(fwxx);
			return 1;
		} catch (Exception e) {
			return 0;
		}
	}

	/**
	 * 删除
	 */
	@Override
	public long removeFwxx(String fwbh) {
		try {
			sessionFactory.getCurrentSession().delete(fwbh);
			return 1;
		} catch (Exception e) {
			return 0;
		}
	}

	/**
	 * 管理我的房租信息根据用户名绑定
	 */
	@Override
	public List<Fwxx> findByyhbh() {
		HttpServletRequest request = ServletActionContext.getRequest();
		String yhbh = (String) request.getSession().getAttribute("bh");
		List<Fwxx> fbf = sessionFactory.getCurrentSession().createQuery(" from  Fwxx where yhbh=?").setString(0, yhbh)
				.list();
		if (fbf != null) {
			return fbf;
		}
		return null;
	}

	/**
	 * 管理我的房租信息
	 */
	@Override
	public Fwxx findBiId() {
		List<Fwxx> lf = sessionFactory.getCurrentSession().createCriteria(Fwxx.class).list();
		if (lf.size() > 0) {
			return (Fwxx) lf;
		}
		return null;
	}

}
package com.zking.service;

import java.util.List;

import com.zking.pojo.Fwxx;

public interface FwxxService {

	public List<Fwxx> findFwxx(String bt, String lxbh, int zj);

	// 管理我的房租信息
	public List<Fwxx> findFwxx(String yhbh);

	// 详情
	public Fwxx findFwxxXq(String fwbh);

	// 管理我的房租信息根据用户绑定
	public List<Fwxx> findByyhbh();

	// 管理我的房租信息
	public Fwxx findBiId();

	public long addFwxx(Fwxx fwxx);

	public long editFwxx(Fwxx fwxx);

	public long removeFwxx(String fwbh);
}
package com.zking.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.zking.dao.FwxxDao;
import com.zking.pojo.Fwxx;
import com.zking.service.FwxxService;

 
@Repository("ixs") // 创建一个UserServiceImpl的bean对象
public class FwxxServiceImpl implements FwxxService {

	@Resource(name = "ixd") // 引用UserDaoImpl的bean对象
	private FwxxDao ixd;

	public FwxxDao getUix() {
		return ixd;
	}

	public void setUix(FwxxDao ixd) {
		this.ixd = ixd;
	}

	@Override
	public List<Fwxx> findFwxx(String bt, String lxbh, int zj) {
		return ixd.findFwxx(bt, lxbh, zj);
	}

	@Override
	public List<Fwxx> findFwxx(String yhbh) {
		return ixd.findFwxx(yhbh);
	}

	@Override
	public Fwxx findFwxxXq(String fwbh) {
		return ixd.findFwxxXq(fwbh);
	}

	// 管理我的房租信息根据用户绑定
	public List<Fwxx> findByyhbh() {
		return ixd.findByyhbh();
	}

	// 管理我的房租信息
	public Fwxx findBiId() {
		return ixd.findBiId();
	}

	@Override
	public long addFwxx(Fwxx fwxx) {
		return ixd.addFwxx(fwxx);
	}

	@Override
	public long editFwxx(Fwxx fwxx) {
		return ixd.editFwxx(fwxx);
	}

	@Override
	public long removeFwxx(String fwbh) {
		return ixd.removeFwxx(fwbh);
	}

}

 

package com.zking.action;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.context.annotation.Scope;

import com.alibaba.fastjson.JSON;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import com.zking.pojo.Fwxx;
import com.zking.service.FwxxService;

@Scope(value = "prototype") // 产生一个新的Bean实例
@ParentPackage("struts-default")
public class FwxxAction extends ActionSupport implements ModelDriven<Fwxx> {

	private static final long serialVersionUID = 1L;

	private Fwxx f = new Fwxx();

	@Resource(name = "ixs") // 引用IUserService的bean对象
	private FwxxService ixs;

	public FwxxService getIxs() {
		return ixs;
	}

	public void setIxs(FwxxService ixs) {
		this.ixs = ixs;
	}

	@Override
	public Fwxx getModel() {
		return f;
	}

	@Action(value = "findAlllistMyFwxxAction", results = { @Result(name = "success", location = "/index.jsp"),
			@Result(name = "error", location = "/404.jsp") })

	public String findAlllistMyFwxx() {
		if (ixs.findFwxx(f.getBt(), f.getLxbh(), f.getZj()) != null) {
			ServletActionContext.getRequest().setAttribute("list1", ixs.findFwxx(f.getBt(), f.getLxbh(), f.getZj()));
			ServletActionContext.getRequest().setAttribute("zj1", f.getZj());
			ServletActionContext.getRequest().setAttribute("zj2", f.getZj());
			ServletActionContext.getRequest().setAttribute("bt1", f.getBt());
			ServletActionContext.getRequest().setAttribute("lxbh1", f.getLxbh());
			return SUCCESS;
		}
		return ERROR;

	}

	@Action(value = "findAlllistMyFwxxAction1", results = { @Result(name = "success", location = "/index2.jsp"),
			@Result(name = "error", location = "/404.jsp") })
	public String findAlllistMyFwxx1() {
		if (ixs.findFwxx(f.getBt(), f.getLxbh(), f.getZj()) != null) {
			ServletActionContext.getRequest().setAttribute("list1", ixs.findFwxx(f.getBt(), f.getLxbh(), f.getZj()));
			ServletActionContext.getRequest().setAttribute("zj1", f.getZj());
			ServletActionContext.getRequest().setAttribute("zj2", f.getZj());
			ServletActionContext.getRequest().setAttribute("bt1", f.getBt());
			ServletActionContext.getRequest().setAttribute("lxbh1", f.getLxbh());
			return SUCCESS;
		}
		return ERROR;

	}

	public String findAllIndex() {

		return ERROR;
	}

	// 增加
	@Action(value = "fwxxaddAction", results = { @Result(name = "success", location = "/listMyFwxx.jsp"),
			@Result(name = "error", location = "/404.jsp") })
	public String FwxxAdd() {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		f.setFbrq(String.valueOf(sdf.format(new Date())));
		if (f != null) {
			if (ixs.addFwxx(f) > 0) {
				return SUCCESS;
			}
		}
		return ERROR;

	}

	// 修改
	@Action(value = "FWxxEditAction", results = { @Result(name = "success", location = "/listMyFwxx.jsp"),
			@Result(name = "error", location = "/404.jsp") })
	public String FWxxEdit() {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		f.setFbrq(String.valueOf(sdf.format(new Date())));
		if (f != null) {
			if (ixs.editFwxx(f) > 0) {
				return SUCCESS;
			}
		}
		return ERROR;
	}

	// 删除
	@Action(value = "fwxxRemoveAction", results = { @Result(name = "success", location = "/listMyFwxx.jsp"),
			@Result(name = "error", location = "/404.jsp") })
	public String FWxxRemove() {
		if (ixs.removeFwxx(f.getFwbh()) > 0) {
			return SUCCESS;
		}

		return ERROR;
	}

	@Action(value = "fwxxXqBangAction", results = { @Result(name = "success", location = "/detailFwxx.jsp"),
			@Result(name = "error", location = "/404.jsp") })
	public String FwxxXq() {
		if (ixs.findFwxxXq(f.getFwbh()) != null) {
			ActionContext.getContext().getValueStack().set("bang", ixs.findFwxxXq(f.getFwbh()));
			return SUCCESS;
		}
		return ERROR;
	}

	@Action(value = "fwxxXqBangLoginAction", results = { @Result(name = "success", location = "/detailFwxxLogin.jsp"),
			@Result(name = "error", location = "/404.jsp") })
	public String FwxxXqLgoin() {
		if (ixs.findFwxxXq(f.getFwbh()) != null) {
			ActionContext.getContext().getValueStack().set("bang", ixs.findFwxxXq(f.getFwbh()));
			return SUCCESS;
		}
		return ERROR;
	}

	@Action(value = "fwxxBangAction", results = { @Result(name = "success", location = "/editFwxx.jsp"),
			@Result(name = "error", location = "/404.jsp") })
	public String FwxxXqEdit() {
		if (ixs.findFwxxXq(f.getFwbh()) != null) {
			ActionContext.getContext().getValueStack().set("bang", ixs.findFwxxXq(f.getFwbh()));
			return SUCCESS;
		}
		return ERROR;
	}

	// 管理我的房租信息
	@Action(value = "findByyhbhAction", results = { @Result(name = "success", location = "/listMyFwxx.jsp"),
			@Result(name = "error", location = "/404.jsp") })
	public String findByyhbh() {
		HttpServletRequest request = ServletActionContext.getRequest();
		if (ixs.findByyhbh().size() > 0) {
			ServletActionContext.getRequest().setAttribute("findBif", ixs.findByyhbh());
			ServletActionContext.getRequest().setAttribute("yhbh", request.getSession().getAttribute("bh"));
			return SUCCESS;
		}
		return ERROR;
	}

	// 管理我的房租信息
	@Action(value = "findBiIdAction", results = { @Result(name = "success", location = "/listMyFwxx.jsp"),
			@Result(name = "error", location = "/404.jsp") })
	public String findBiId() {
		ServletActionContext.getRequest().setAttribute("flist1", ixs.findBiId());
		return SUCCESS;
	}

	public void print(String outStr) {
		HttpServletResponse response = ServletActionContext.getResponse();
		try {
			response.getWriter().println(JSON.toJSONString(outStr));
			response.getWriter().flush();
			response.getWriter().close();
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

}

 applicationContext-public.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:aop="http://www.springframework.org/schema/aop"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:util="http://www.springframework.org/schema/util"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
		http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd
		http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.3.xsd
		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd">


	<!-- 开启自动扫描 -->
	<context:component-scan base-package="com.zking" />

	<!-- 配置数据库连接池 -->
	<bean id="c3p0Source"
		class="com.mchange.v2.c3p0.ComboPooledDataSource">
		<!-- 驱动 -->
		<property name="driverClass" value="com.mysql.jdbc.Driver"></property>

		<!-- 连接地址 -->
		<property name="jdbcUrl"
			value="jdbc:mysql://localhost:3306/fz"></property>

		<!-- 用户名 -->
		<property name="user" value="root"></property>

		<!-- 密码 -->
		<property name="password" value="sasa"></property>

		<!-- 初始化连接数 -->
		<property name="initialPoolSize" value="3"></property>

		<!-- 最大连接数 -->
		<property name="maxPoolSize" value="20"></property>
	</bean>

	<!-- 配置sessionfactory -->

	<bean id="sessionFactoryBean"
		class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
		<!-- 引入数据源 -->
		<property name="dataSource" ref="c3p0Source"></property>

		<!-- 加载hibernate配置文件 -->
		<!-- 引入hibernate配置文件 -->
		<property name="hibernateProperties">
			<props>
				<prop key="hibernate.show_sql">true</prop>
				<prop key="hibernate.format_sql">true</prop>
				<prop key="hibernate.current_session_context_class">org.springframework.orm.hibernate5.SpringSessionContext
				</prop>
			</props>
		</property>

		<!-- 映射实体文件位置 -->
		<property name="packagesToScan">
			<array>
				<value>com.zking.pojo</value>
			</array>
		</property>
	</bean>

	<!-- 配置事务 -->
	<bean id="transactionManager"
		class="org.springframework.orm.hibernate5.HibernateTransactionManager">
		<property name="sessionFactory" ref="sessionFactoryBean"></property>
	</bean>

	<!-- 配置事务属性 -->
	<tx:advice id="advice"
		transaction-manager="transactionManager">
		<tx:attributes>
			<tx:method name="add*" propagation="REQUIRED" />
			<tx:method name="edit*" propagation="REQUIRED" />
			<tx:method name="remove*" propagation="REQUIRED" />
			<tx:method name="*" />
		</tx:attributes>
	</tx:advice>

	<!-- 配置事务属性切点 -->
	<aop:config>
		<aop:pointcut
			expression="execution(* com.zking.service.*.*(..))"
			id="pointcut" />
		<aop:advisor advice-ref="advice" pointcut-ref="pointcut" />
	</aop:config>



</beans>

listMyFwxx.jsp 

<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
<title>租房网</title>
<link href="style/mycss.css" rel="stylesheet" type="text/css" />
<link href="style/text.css" rel="stylesheet" type="text/css" />
<link href="style/btn.css" rel="stylesheet" type="text/css" />
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
</head>
<BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0
	MARGINHEIGHT=0>
	<table width="780" border="0" align="center" cellpadding="0"
		cellspacing="0">
		<tr>
			<td colspan="5"><img src="images/top.jpg" width="800"
				height="213"></td>
		</tr>
		<tr>
			<td colspan="5"><img src="images/middle1.jpg" width="800"
				height="47"></td>
		</tr>
		<tr>
			<td width="38" background="images/middle2.jpg">&nbsp;</td>
			<td width="172" valign="top" align="center">
				<p>&nbsp;</p>
				<table align="center">
					<tr>
						<td style="font-size: 20px;"><font color='red'>当前用户:<s:property
									value="%{#request.session.zh}" />
						</font></td>
					</tr>
					<tr>
						<td>&nbsp;</td>
					</tr>
					<tr>
						<td>&nbsp;</td>
					</tr>
					<tr>
						<td width='150'><a
							href='listMyFwxx.jsp?yhbh=<s:property value="%{#request.session.bh}"/>'>
								管理我的租房信息</a></td>
					</tr>
					<tr>
						<td>&nbsp;</td>
					</tr>
					<tr>
						<td width='100'><a href="addFwxx.jsp">发布租房信息</a></td>
					</tr>
					<tr>
						<td>&nbsp;</td>
					</tr>
					<tr>
						<td width='100'><a a href="index2.jsp">返回首页</a></td>
					</tr>
					<tr>
						<td>&nbsp;</td>
					</tr>
					<tr>
						<td width='100'><a href="index.jsp">[注销]</a></td>
					</tr>
				</table>
			</td>


			<s:if test="#request.findBif==null">
				<s:action name="findByyhbhAction" var="findByyhbhAction"
					ignoreContextParams="true">
				</s:action>
			</s:if>



			<td width="35" background="images/layout_24.gif">&nbsp;</td>
			<td width="495" align="center">
				<table>
					<tr>
						<td width="3%">&nbsp;</td>
						<td width="97%">
							<table style="width: 450px;">
								<tr>
									<td style="width: 280px;">标题</td>
									<td style="width: 100px;" align='center'>月租金</td>
									<td style="width: 100px;" align='center'>发布日期</td>
									<td style="width: 50px;">&nbsp;</td>
									<td style="width: 50px;">&nbsp;</td>
								</tr>
								<tr>
									<td colspan='5'><hr /></td>
								</tr>

								<s:iterator var="l" value="#request.findBif">

									<tr>
										<td><s:url var="xqAction" action="fwxxXqBangAction">
												<s:param name="fwbh" value="#l.fwbh"></s:param>
											</s:url> <s:a href="%{#xqAction}">
												<s:property value="#l.bt" />
											</s:a></td>
										<td align='center'><s:property value="#l.zj" />元</td>
										<td align='center'><s:property value="#l.fbrq" /></td>
										<td align='center' style='height: 30px;'><a
											href='fwxxRemoveAction?fwbh=<s:property value="#l.fwbh"/>'>[删除]</a></td>
										<td align='center' style='height: 30px;'><s:url
												var="UpdateUrl" action="fwxxBangAction">
												<s:param name="fwbh" value="#l.fwbh"></s:param>
											</s:url> <s:a href="%{#UpdateUrl}">[修改]</s:a></td>
									</tr>
								</s:iterator>
								<tr>
									<td colspan='5'><hr /></td>
								</tr>
							</table>

						</td>
					</tr>
					<tr>
						<td colspan="2"></td>
					</tr>
				</table>
			</td>
			<td width="40" background="images/middle4.jpg">&nbsp;</td>
		</tr>
		<tr>
			<td colspan="5"><img src="images/bottom.jpg" width="800"
				height="82"></td>
		</tr>
	</table>
	<P align="center">Zking版权所有</P>
	<br />
</BODY>
</html>

 editFwxx.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
<title>租房网</title>
<link href="style/mycss.css" rel="stylesheet" type="text/css" />
<link href="style/text.css" rel="stylesheet" type="text/css" />
<link href="style/btn.css" rel="stylesheet" type="text/css" />
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
</head>
<BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0
	MARGINHEIGHT=0>
	<table width="780" border="0" align="center" cellpadding="0"
		cellspacing="0">
		<tr>
			<td colspan="5"><img src="images/top.jpg" width="800"
				height="213"></td>
		</tr>
		<tr>
			<td colspan="5"><img src="images/middle1.jpg" width="800"
				height="47"></td>
		</tr>
		<tr>
			<td width="38" background="images/middle2.jpg">&nbsp;</td>
			<td width="172" valign="top" align="center">
				<p>&nbsp;</p>
				<table align="center">
					<tr>
						<td style="font-size: 20px;"><font color='red'>当前用户:<s:property
									value="%{#request.session.zh}" />
						</font></td>
					</tr>
					<tr>
						<td>&nbsp;</td>
					</tr>
					<tr>
						<td>&nbsp;</td>
					</tr>
					<tr>
						<td width='150'><a
							href='listMyFwxx.jsp?yhbh=<s:property value="%{#request.session.bh}"/>'>
								管理我的租房信息</a></td>
					</tr>
					<tr>
						<td>&nbsp;</td>
					</tr>
					<tr>
						<td width='100'><a href="addFwxx.jsp">发布租房信息</a></td>
					</tr>
					<tr>
						<td>&nbsp;</td>
					</tr>
					<tr>
						<td width='100'><a a href="index2.jsp">返回首页</a></td>
					</tr>
					<tr>
						<td>&nbsp;</td>
					</tr>
					<tr>
						<td width='100'><a href="index.jsp">[注销]</a></td>
					</tr>
				</table>
			</td>
			<td width="35" background="images/layout_24.gif">&nbsp;</td>
			<td width="495" align="center">
			
			<s:form 
					action="FWxxEditAction" method="post" theme="simple">
					
					<s:hidden name="yhbh" value="%{#request.session.bh}"></s:hidden>

					<s:push value="bang">
						<table>
							<tr>
								<td colspan="2">修改租房信息:</td>
							</tr>
							<tr>
								<td colspan="2"><hr /></td>
							</tr>
							<tr>
								<s:hidden name="fwbh"></s:hidden>
								
								<s:hidden name="fwrq"></s:hidden>
								
								<td><strong>标题:</strong></td>
								<td><s:textfield name="bt"></s:textfield></td>
							</tr>
							<tr>
								<td><strong>地址:</strong></td>
								<td><s:textfield name="dz"></s:textfield></td>
							</tr>
							<tr>
								<td><strong>租金:</strong></td>
								<td><s:textfield name="zj"></s:textfield></td>
							</tr>
							<tr>
								<td><strong>联系人:</strong></td>
								<td><s:textfield name="lxr"></s:textfield></td>
							</tr>
							<tr>
								<td><strong>联系电话:</strong></td>
								<td><s:textfield name="lxdh"></s:textfield></td>
							</tr>
							<tr>

								<td><strong>房屋类型:</strong></td>
								<s:action name="addfwlxbangAction" var="addfwlxbang"
									ignoreContextParams="true"></s:action>
								<td><s:select name="lxbh" list="#request.list"
										listKey="lxbh" listValue="lxmc">
									</s:select></td>
							</tr>

							<tr>
								<td><strong>装修情况:</strong></td>
								<td><s:select list="#{1:'毛坯房',2:'简单装修',3:'精装修',4:'豪华装修'} "
										name="zxqk"></s:select></td>
							</tr>
							<tr>
								<td><strong>所在楼层:</strong></td>

								<td><s:select
										list="#{1:'一层',2:'二层',3:'三层',4:'四层~六层',5:'七层~以上'} "
										name="szlc"></s:select></td>
							</tr>
							<tr>
								<td><strong>房屋朝向:</strong></td>
								<td><s:select
										list="#{1:'东',2:'南',3:'西',4:'北',5:'东西',6:'南北'} " name="fwcx"></s:select></td>

							</tr>
							<tr>
								<td><strong>备注:</strong></td>
								<td><textarea rows="5" cols="30">拎包入住,温馨高档方便!可日租,月租均可!
</textarea></td>
							</tr>
							<tr>
								<td colspan="2">
									<div align="center">
										<s:submit value="提交"></s:submit>
									</div>
								</td>
							</tr>
						</table>

					</s:push>
				</s:form></td>
			<td width="40" background="images/middle4.jpg">&nbsp;</td>
		</tr>
		<tr>
			<td colspan="5"><img src="images/bottom.jpg" width="800"
				height="82"></td>
		</tr>
	</table>
	<P align="center">Zking版权所有</P>
	<br />
</BODY>
</html>

 

今天的文章SSH整合注解释_注的含义分享到此就结束了,感谢您的阅读。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/65651.html

(0)
编程小号编程小号

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注