S2SH CRUD 整合
采用的框架 Struts2+Spring4+Hbiernate4.
目录结构
:
EmployeeAction:
- package com.xx.ssh.actions;
- import java.io.ByteArrayInputStream;
- import java.io.InputStream;
- import java.io.UnsupportedEncodingException;
- import java.util.Date;
- import java.util.Map;
- import org.apache.struts2.interceptor.RequestAware;
- import com.opensymphony.xwork2.ActionSupport;
- import com.opensymphony.xwork2.ModelDriven;
- import com.opensymphony.xwork2.Preparable;
- import com.xx.ssh.entities.Employee;
- import com.xx.ssh.service.DepartmentService;
- import com.xx.ssh.service.EmployeeService;
- public class EmployeeAction extends ActionSupport implements RequestAware,
- ModelDriven<Employee>, Preparable {
- private static final long serialVersionUID = 1L;
- private EmployeeService employssService;
- public void setEmployssService(EmployeeService employssService) {
- this.employssService = employssService;
- }
- private DepartmentService departmentService;
- public void setDepartmentService(DepartmentService departmentService) {
- this.departmentService = departmentService;
- }
- public String list() {
- request.put("employees", employssService.getAll());
- System.out.println("request: " + request.size());
- return "list";
- }
- private Integer id;
- public void setId(Integer id) {
- this.id = id;
- }
- private InputStream inputStream;
- public InputStream getInputStream() {
- return inputStream;
- }
- //回调函数。判断是否删除
- public String delete() {
- try {
- employssService.delete(id);
- inputStream = new ByteArrayInputStream("1".getBytes("UTF-8"));
- } catch (Exception e) {
- e.printStackTrace();
- try {
- inputStream = new ByteArrayInputStream("0".getBytes("UTF-8"));
- } catch (UnsupportedEncodingException e1) {
- e1.printStackTrace();
- }
- }
- return "ajax-success";
- }
- private String lastName;
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
- //回调函数。判断用户名是否存在。
- public String validateLastName() {
- try {
- if (employssService.lastNameIsValid(lastName)) {
- inputStream = new ByteArrayInputStream("1".getBytes("utf-8"));
- } else {
- inputStream = new ByteArrayInputStream("0".getBytes("utf-8"));
- }
- } catch (Exception e) {
- }
- return "ajax-success";
- }
- private Employee model;
- /*
- * 可以根椐ID来判断为save方法准备的model是new的还是数据库获取的。
- */
- public void prepareSave() {
- if (id == null) {
- model = new Employee();
- } else {
- model = employssService.get(id);
- }
- }
- public String save() {
- if (id == null) {
- model.setCreateTime(new Date());
- }
- employssService.saveOrUpdate(model);
- return SUCCESS;
- }
- public String input() {
- request.put("departments", departmentService.getAll());
- return INPUT;
- }
- public void prepareInput() {
- if (id != null) {
- model = employssService.get(id);
- }
- }
- private Map<String, Object> request;
- @Override
- public void setRequest(Map<String, Object> arg0) {
- this.request = arg0;
- }
- @Override
- public Employee getModel() {
- return model;
- }
- @Override
- public void prepare() throws Exception {
- }
- }
SSHDateConverter:自定义转换器
- package com.xx.ssh.converters;
- import java.text.DateFormat;
- import java.text.ParseException;
- import java.text.SimpleDateFormat;
- import java.util.Date;
- import java.util.Map;
- import org.apache.struts2.util.StrutsTypeConverter;
- public class SSHDateConverter extends StrutsTypeConverter {
- private DateFormat dateFormat;
- {
- dateFormat = new SimpleDateFormat("yyyy-MM-dd");
- }
- @Override
- public Object convertFromString(Map context, String[] values, Class toClass) {
- if(toClass == Date.class){
- try {
- return dateFormat.parse(values[0]);
- } catch (ParseException e) {
- e.printStackTrace();
- }
- }
- return null;
- }
- @Override
- public String convertToString(Map context, Object o) {
- if(o instanceof Date){
- return dateFormat.format((Date)o);
- }
- return null;
- }
- }
BaseDao:SessionFactory
- package com.xx.ssh.dao;
- import org.hibernate.Session;
- import org.hibernate.SessionFactory;
- public class BaseDao {
- private SessionFactory sessionFactory;
- public void setSessionFactory(SessionFactory sessionFactory) {
- this.sessionFactory = sessionFactory;
- }
- public Session getSession() {
- return this.sessionFactory.getCurrentSession();
- }
- }
DepartmentDao:Dao层
- package com.xx.ssh.dao;
- import java.util.List;
- import com.xx.ssh.entities.Department;
- public class DepartmentDao extends BaseDao{
- public List<Department> getAll(){
- String hql="FROM Department";
- return getSession().createQuery(hql).list();
- }
- }
EmployeeDao
- package com.xx.ssh.dao;
- import java.util.List;
- import org.hibernate.Query;
- import org.hibernate.Session;
- import org.hibernate.SessionFactory;
- import com.xx.ssh.entities.Employee;
- public class EmployeeDao extends BaseDao {
- public void delete(Integer id){
- String hql="delete from Employee e where e.id=? ";
- getSession().createQuery(hql).setInteger(0,id).executeUpdate();
- }
- public List<Employee> getAll(){
- String hql="from Employee e LEFT OUTER JOIN FETCH e.department";
- return getSession().createQuery(hql).list();
- }
- public void saveOrUpdate(Employee employee){
- getSession().saveOrUpdate(employee);
- }
- public Employee getEmployeeByLastName(String lastName){
- String hql="from Employee e where e.lastName=? ";
- Query query = getSession().createQuery(hql).setString(0,lastName);
- return (Employee)query.uniqueResult();
- }
- public Employee get(Integer id){
- return (Employee) getSession().get(Employee.class,id);
- }
- }
实体:Department
- package com.xx.ssh.entities;
- public class Department {
- private Integer id;
- private String departmentName;
- public Integer getId() {
- return id;
- }
- public void setId(Integer id) {
- this.id = id;
- }
- public String getDepartmentName() {
- return departmentName;
- }
- public void setDepartmentName(String departmentName) {
- this.departmentName = departmentName;
- }
- }
实体:Employee
- package com.xx.ssh.entities;
- import java.util.Date;
- public class Employee {
- //
- private Integer id;
- //不能被修改
- private String lastName;
- private String email;
- //从前端传入的是string类型,所以需要注意转换。
- private Date birth;
- //不能被修改
- private Date createTime;
- //单向n-1的关联关系
- private Department department;
- public Integer getId() {
- return id;
- }
- public void setId(Integer id) {
- this.id = id;
- }
- public String getLastName() {
- return lastName;
- }
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
- public String getEmail() {
- return email;
- }
- public void setEmail(String email) {
- this.email = email;
- }
- public Date getBirth() {
- return birth;
- }
- public void setBirth(Date birth) {
- this.birth = birth;
- }
- public Date getCreateTime() {
- return createTime;
- }
- public void setCreateTime(Date createTime) {
- this.createTime = createTime;
- }
- public Department getDepartment() {
- return department;
- }
- public void setDepartment(Department department) {
- this.department = department;
- }
- @Override
- public String toString() {
- return "Employee [birth=" + birth + ", createTime=" + createTime
- + ", department.id=" + department + ", email=" + email + ", id="
- + id + ", lastName=" + lastName + "]";
- }
- }
表与类映射文件配置。
Department.hbm.xml
- <?xml version="1.0"?>
- <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
- <!-- Generated 2014-7-22 11:21:48 by Hibernate Tools 3.4.0.CR1 -->
- <hibernate-mapping>
- <class name="com.xx.ssh.entities.Department" table="SSH_DEPARTMENT">
- <id name="id" type="java.lang.Integer">
- <column name="ID" />
- <generator class="native" />
- </id>
- <property name="departmentName" type="java.lang.String">
- <column name="DEPARTMENT_NAME" />
- </property>
- </class>
- </hibernate-mapping>
Employee.hbm.xml
- <?xml version="1.0"?>
- <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
- <!-- Generated 2014-7-22 11:21:48 by Hibernate Tools 3.4.0.CR1 -->
- <hibernate-mapping>
- <class name="com.xx.ssh.entities.Employee" table="SSH_EMPLOYEE">
- <id name="id" type="java.lang.Integer">
- <column name="ID" />
- <generator class="native" />
- </id>
- <property name="lastName" type="java.lang.String">
- <column name="LAST_NAME" />
- </property>
- <property name="email" type="java.lang.String">
- <column name="EMAIL" />
- </property>
- <property name="birth" type="java.util.Date">
- <column name="BIRTH" />
- </property>
- <property name="createTime" type="java.util.Date">
- <column name="CREATE_TIME" />
- </property>
- <!-- 映射单向 n-1 的关联关系 -->
- <many-to-one name="department" class="com.xx.ssh.entities.Department" lazy="false">
- <column name="DEPARTMENT_ID" />
- </many-to-one>
- </class>
- </hibernate-mapping>
Service层:Department
- package com.xx.ssh.service;
- import java.util.List;
- import com.xx.ssh.dao.DepartmentDao;
- import com.xx.ssh.entities.Department;
- public class DepartmentService {
- private DepartmentDao departmentDao;
- public void setDepartmentDao(DepartmentDao departmentDao){
- this.departmentDao=departmentDao;
- }
- public List<Department>getAll(){
- return departmentDao.getAll();
- }
- }
Service层:Employee
- package com.xx.ssh.service;
- import java.util.List;
- import com.xx.ssh.dao.EmployeeDao;
- import com.xx.ssh.entities.Employee;
- public class EmployeeService {
- private EmployeeDao employeeDao;
- public void setEmployeeDao(EmployeeDao employeeDao)
- {
- this.employeeDao=employeeDao;
- }
- public boolean lastNameIsValid(String lastName){
- return employeeDao.getEmployeeByLastName(lastName)==null;
- }
- public void delete(Integer id){
- employeeDao.delete(id);
- }
- public void saveOrUpdate(Employee employee){
- employeeDao.saveOrUpdate(employee);
- }
- public List<Employee> getAll(){
- List<Employee> employees=employeeDao.getAll();
- /*employees.clear();*/
- System.out.println(employees.size());
- return employees;
- }
- public Employee get(Integer id) {
- // TODO Auto-generated method stub
- return employeeDao.get(id);
- }
- }
配置文件:
applicationContext-beans.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"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd">
- <bean id="employeeDao" class="com.xx.ssh.dao.EmployeeDao">
- <property name="sessionFactory" ref="sessionFactory"></property>
- </bean>
- <bean id="departmentDao" class="com.xx.ssh.dao.DepartmentDao">
- <property name="sessionFactory" ref="sessionFactory"></property>
- </bean>
- <bean id="employeeService" class="com.xx.ssh.service.EmployeeService">
- <property name="employeeDao" ref="employeeDao"></property>
- </bean>
- <bean id="departmentService" class="com.xx.ssh.service.DepartmentService">
- <property name="departmentDao" ref="departmentDao"></property>
- </bean>
- <bean id="employeeAction" class="com.xx.ssh.actions.EmployeeAction"
- scope="prototype">
- <property name="employssService" ref="employeeService"></property>
- <property name="departmentService" ref="departmentService"></property>
- </bean>
- </beans>
applicationContext.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:tx="http://www.springframework.org/schema/tx"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/aop
- http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-4.0.xsd
- http://www.springframework.org/schema/tx
- http://www.springframework.org/schema/tx/spring-tx-4.0.xsd">
- <!-- 导入资源文件 -->
- <context:property-placeholder location="classpath:db.properties"/>
- <!-- 配置 C3P0 数据源 -->
- <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
- <property name="user" value="${jdbc.user}"></property>
- <property name="password" value="${jdbc.password}"></property>
- <property name="driverClass" value="${jdbc.driverClass}"></property>
- <property name="jdbcUrl" value="${jdbc.jdbcUrl}"></property>
- </bean>
- <!-- 配置 SessionFactory -->
- <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
- <property name="dataSource" ref="dataSource"></property>
- <property name="configLocation" value="classpath:hibernate.cfg.xml"></property>
- <property name="mappingLocations" value="classpath:com/xx/ssh/entities/*.hbm.xml"></property>
- </bean>
- <!-- 配置 Spring 的声明式事务 -->
- <!-- 1. 配置 hibernate 的事务管理器 -->
- <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
- <property name="sessionFactory" ref="sessionFactory"></property>
- </bean>
- <!-- 2. 配置事务属性 -->
- <tx:advice id="txAdvice" transaction-manager="transactionManager">
- <tx:attributes>
- <tx:method name="get*" read-only="true"/>
- <tx:method name="lastNameIsValid" read-only="true"/>
- <tx:method name="*"/>
- </tx:attributes>
- </tx:advice>
- <!-- 3. 配置事务切入点, 再把事务属性和事务切入点关联起来 -->
- <aop:config>
- <aop:pointcut expression="execution(* com.xx.ssh.service.*.*(..))" id="txPointcut"/>
- <aop:advisor advice-ref="txAdvice" pointcut-ref="txPointcut"/>
- </aop:config>
- </beans>
db.properties
- jdbc.user=root
- jdbc.password=root
- jdbc.driverClass=com.mysql.jdbc.Driver
- jdbc.jdbcUrl=jdbc:mysql:///spring6
- jdbc.initPoolSize=5
- jdbc.maxPoolSize=10
hibernate.cfg.xml
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE hibernate-configuration PUBLIC
- "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
- <hibernate-configuration>
- <session-factory>
- <!-- 配置hibernate的基本属性-->
- <!-- 方言 -->
- <property name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
- <!--是否显示及格式化SQL-->
- <property name="hibernate.show_sql">true</property>
- <property name="hibernate.format_sql">true</property>
- <!-- 生成数据表的策略 -->
- <property name="hibernate.hbm2ddl.auto">update</property>
- <!--二级缓存相关 -->
- </session-factory>
- </hibernate-configuration>
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">
- <!-- 定义新的拦截器栈, 配置 prepare 拦截器栈的 alwaysInvokePrepare 参数值为 false -->
- <interceptors>
- <interceptor-stack name="sshStack">
- <interceptor-ref name="paramsPrepareParamsStack">
- <param name="prepare.alwaysInvokePrepare">false</param>
- </interceptor-ref>
- </interceptor-stack>
- </interceptors>
- <!-- 使用新的拦截器栈 -->
- <default-interceptor-ref name="sshStack"></default-interceptor-ref>
- <action name="emp-*" class="employeeAction"
- method="{1}">
- <result name="list">/WEB-INF/views/emp-list.jsp</result>
- <result type="stream" name="ajax-success">
- <param name="contentType">text/html</param>
- <param name="inputName">inputStream</param>
- </result>
- <result name="input">/WEB-INF/views/emp-input.jsp</result>
- <result name="success" type="redirect">/emp-list</result>
- </action>
- </package>
- </struts>
xwork-conversion.properties :时间转换器配置文件。
java.util.Date=com.xx.ssh.converters.SSHDateConverter
web.xml
- <?xml version="1.0" encoding="UTF-8"?>
- <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
- http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
- <context-param>
- <param-name>contextConfigLocation</param-name>
- <param-value>classpath:applicationContext*.xml</param-value>
- </context-param>
- <listener>
- <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
- </listener> <!-- 为spring添加监听器 -->
- <!-- 配置 Struts2 的 Filter -->
- <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>
- </web-app>
JSP:
emp-input.jsp:
- <%@ page language="java" contentType="text/html; charset=UTF-8"
- pageEncoding="UTF-8"%>
- <%@ taglib prefix="s" uri="/struts-tags" %>
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>Insert title here</title>
- <script type="text/javascript" src="${pageContext.request.contextPath}/scripts/jquery-1.8.0.js"></script>
- <script type="text/javascript">
- $(function(){
- $(":input[name=lastName]").change(function(){
- var val= $(this).val();
- val=$.trim(val);
- var $this=$(this);
- if(val!=""){
- $this.nextAll("font").remove();
- var url="emp-validateLastName";
- var args={"lastName":val,"time":new Date()};
- $.post(url,args,function(data){
- //表示可用
- if(data == "1"){
- $this.after("<font color='green'>LastName可用</font>" );
- }
- //表示不可用
- else if(data == "0") {
- $this.after("<font color='red'>LastName不可用</font>" );
- }else{
- alert("服务器错误");
- }
- })
- }else{
- //alert("lastName 不能为空");
- var i=$(this).val("");
- alert(i);
- //this.focus();
- }
- })
- })
- </script>
- </head>
- <body>
- <s:debug></s:debug>
- <h4>Employee Input Page</h4>
- <s:form action="emp-save" method="post">
- <s:if test="id != null">
- <s:textfield name="lastName" label="LastName" disabled="true"></s:textfield>
- <s:hidden name="id"></s:hidden>
- <%--
- <!-- 通过添加隐藏域的方式把未显式提交的字段值提交到服务器 -->
- <s:hidden name="lastName"></s:hidden>
- <s:hidden name="createTime"></s:hidden>
- --%>
- </s:if>
- <s:else>
- <s:textfield name="lastName" label="LastName"></s:textfield>
- </s:else>
- <s:textfield name="email" label="Email"></s:textfield>
- <s:textfield name="birth" label="Birth"></s:textfield>
- <s:select list="#request.departments"
- listKey="id" listValue="departmentName" name="department.id"
- label="Department"></s:select>
- <s:submit></s:submit>
- </s:form>
- </body>
- </html>
emp-list.jsp:
- <%@ page language="java" contentType="text/html; charset=UTF-8"
- pageEncoding="UTF-8"%><!-- -->
- <%@ taglib prefix="s" uri="/struts-tags"%>
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>Insert title here</title>
- <script type="text/javascript" src="${pageContext.request.contextPath }/scripts/jquery-1.8.0.js"></script>
- <script type="text/javascript" >
- $(function(){
- //1.点击delete时,弹出确定是要删除xx的信息吗。若确定,删除。反之。取消
- $(".delete").click(function(){
- var lastName=$(this).next(":input").val();
- var flag=confirm("确定是要删除"+lastName+"信息吗?");
- if(flag){
- var $tr=$(this).parent().parent();
- //删除,使用ajax方式 。
- var url=this.href;
- var args={"time":new Date()};
- $.post(url,args,function(data){
- //若data的返回值为1.则提示删除成功,且把当前行删除 。
- if(data=="1"){
- alert("删除成功");
- $tr.remove();
- }else{
- alert("删除失败");
- }
- });
- }
- //取消默认行为。
- return false;
- });
- });
- </script>
- </head>
- <body>
- <h4>Employee List Page</h4>
- <s:if test="#request.employees == null || #request.employees.size()==0">
- 没有任何员工信息;
- </s:if>
- <s:else>
- <table border="1" cellpadding="10" cellspacing="0">
- <tr>
- <td>ID</td>
- <td>LASTNAME</td>
- <td>EMAIL</td>
- <td>BIRTH</td>
- <td>CREATETIME</td>
- <td>DEPT</td>
- <td>DELETE</td>
- <td>Edit</td>
- </tr>
- <s:iterator value="#request.employees">
- <tr>
- <td>${id } </td>
- <td>${lastName }</td>
- <td>${email }</td>
- <td>
- <s:date name="birth" format="yyyy-MM-dd"/>
- </td>
- <td>
- <s:date name="birth" format="yyyy-MM-dd hh:mm:ss"/>
- </td>
- <td>${department.departmentName }</td>
- <td><a href="emp-delete?id=${id }" class="delete">Delete</a>
- <input type="hidden" value="${lastName }"/>
- </td>
- <td><a href="emp-input?id=${id }">Edit</a></td>
- </tr>
- </s:iterator>
- </table>
- </s:else>
- </body>
- </html>
S2SH CRUD 整合的更多相关文章
- s2sh框架整合具体配置-xml方式
s2sh整合之xml方式 说明:本文档所採用的框架版本号为:Struts 2.1.8, Sping2.5.5, Hibernate 3.5.6 1. 须要的jar包: ------------ ...
- S2SH框架整合(注解)Struts2+Spring+Hibernate+MySql
整合简介 Struts2+Spring4+hibernate4整合,Maven管理jar包,Eclipse工具.注解方式 架构截图 1.Spring整合Hibernate 1.1.创建Hibern ...
- 框架技术--S2SH框架整合(spring部分)No 3--声明式事务
声明式事务:就是讲事务的处理,通过配置进行配置. 几种传播特性 1. PROPAGATION_REQUIRED: 如果存在一个事务,则支持当前事务.如果没有事务则开启(比较常用) 2. PROPA ...
- Spring入门4.AOP配置深入
Spring入门4.AOP配置深入 代码下载 链接: http://pan.baidu.com/s/11mYEO 密码: x7wa 前言: 之前学习AOP中的一些概念,包括连接点.切入点(pointc ...
- JAVA学习路线图---(JAVA1234)
第一阶段-Java基础 这一阶段很重要,关系到你后面阶段的学习,所以务必把这一阶段掌握好: 如果你是0基本,我推荐一本比较好的,适合初学者看的书:明日科技的<Java从入门到精通>,最 ...
- JAVA学习路线图---(JAVA1234) 分类: B1_JAVA 2013-10-05 10:22 502人阅读 评论(1) 收藏
转自:http://blog.csdn.net/pplcheer/article/details/12276999 第一阶段-Java基础 这一阶段很重要,关系到你后面阶段的学习,所以务 ...
- JDBC基础:JDBC快速入门,JDBC工具类,SQL注入攻击,JDBC管理事务
JDBC基础 重难点梳理 一.JDBC快速入门 1.jdbc的概念 JDBC(Java DataBase Connectivity:java数据库连接)是一种用于执行SQL语句的Java API,可以 ...
- 整合s2sh,实现页面操作数据库
先说点废话 s2sh,就是struts2,spring,hibernate:s2作为表现层和控制器,hibernate作为持久层,spring作为业务层(充分应用IOC和AOP).其实业务还是业务,只 ...
- Spring boot(三)整合mybaties+thymeleaf实现基础crud
工程结构: 首先在pom文件中引入依赖 <?xml version="1.0" encoding="UTF-8"?> <project xml ...
随机推荐
- golang flag包
go flag 包用来解析命令行参数,通过一个简单的例子来了解下 package main import ( "flag" "fmt" ) fu ...
- Saddest's polar bear Pizza offered new YorkShire home
Saddest:adj,可悲的,悲哀的,polar,两级的,极地额,YorkShire,约克郡 A UK wildlife park has confirmed that it is offering ...
- EXT.net DateField format设置
DateField df = new DateField(); df.Format = "yyyy-MM-dd HH:mm:ss";格 ...
- fastdfs-nginx扩展模块源码分析
FastDFS-Nginx扩展模块源码分析 1. 背景 在大多数业务场景中,往往需要为FastDFS存储的文件提供http下载服务,而尽管FastDFS在其storage及tracker都内置了htt ...
- [转]PHP Session的一个警告
警告全文如下: PHP Warning: Unknown: Your script possibly relies on a session side-effect which existed unt ...
- php.ini修改php上传文件大小限制的方法详解
打开php.ini,首先找到file_uploads = on ;是否允许通过HTTP上传文件的开关.默认为ON即是开upload_tmp_dir ;文件上传至服务器上存储临时文件的地方,如果没指定就 ...
- 基于Lattice_CPLD/FPGA Diamond 开发流程
本文主要介绍了Lattice CPLD/FPGA集成开发环境的使用方法,并通过点亮开发板(Mach XO2 Breakout Board)上位号为D2的LED这一实例来演示其开发流程. 1. ...
- 在ASP.NET Web API中使用OData
http://www.alixixi.com/program/a/2015063094986.shtml 一.什么是ODataOData是一个开放的数据协议(Open Data Protocol)在A ...
- 使用图灵机器人API实现聊天机器人
使用图灵机器人的API需要先注册,获取key才行,这我就不说了,自己到http://www.tuling123.com/注册一个账号即可. 下面就是一个简单的python调用API实现聊天机器人的简易 ...
- maven的阿里镜像
偶然发现maven有了阿里镜像 vim ~/.m2/setting.xml <mirrors> <mirror> <id>alimaven</id> & ...