`
斌强-朱
  • 浏览: 51414 次
社区版块
存档分类
最新评论

SSH整合 简单的增删改查

 
阅读更多

Database 使用 Mysql ,

建立User 表

CREATE TABLE `user` (
  `id` int(11) NOT NULL,
  `firstName` varchar(20) DEFAULT NULL,
  `lastName` varchar(20) DEFAULT NULL,
  `age` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) 
所需jar包

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
	<classpathentry kind="src" path="src"/>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
	<classpathentry kind="con" path="melibrary.com.genuitec.eclipse.j2eedt.core.MYECLIPSE_JAVAEE_5_CONTAINER"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/struts2-spring-plugin-2.3.4.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/antlr-2.7.6.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/cglib-2.2.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-collections-3.1.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/dom4j-1.6.1.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/ehcache-1.2.3.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/ejb3-persistence.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/hibernate-annotations.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/hibernate-commons-annotations.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/hibernate-entitymanager.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/hibernate-validator.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/hibernate3.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/javassist-3.9.0.GA.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/jta-1.1.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/log4j-1.2.14.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/slf4j-api-1.5.8.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/slf4j-log4j12-1.5.8.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/com.springsource.net.sf.cglib-2.2.0.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/com.springsource.org.aopalliance-1.0.0.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/com.springsource.org.apache.commons.fileupload-1.2.0.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/com.springsource.org.apache.commons.httpclient-3.1.0.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/com.springsource.org.apache.commons.logging-1.1.1.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/com.springsource.org.apache.log4j-1.2.15.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/com.springsource.org.aspectj.weaver-1.6.8.RELEASE.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/com.springsource.org.codehaus.jackson.mapper-1.0.0.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/org.springframework.aop-3.0.1.RELEASE-A.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/org.springframework.asm-3.0.1.RELEASE-A.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/org.springframework.aspects-3.0.1.RELEASE-A.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/org.springframework.beans-3.0.1.RELEASE-A.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/org.springframework.context-3.0.1.RELEASE-A.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/org.springframework.core-3.0.1.RELEASE-A.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/org.springframework.expression-3.0.1.RELEASE-A.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/org.springframework.instrument-3.0.1.RELEASE-A.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/org.springframework.instrument.tomcat-3.0.1.RELEASE-A.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/org.springframework.jdbc-3.0.1.RELEASE-A.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/org.springframework.orm-3.0.1.RELEASE-A.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/org.springframework.oxm-3.0.1.RELEASE-A.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/org.springframework.transaction-3.0.1.RELEASE-A.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/org.springframework.web-3.0.1.RELEASE-A.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/org.springframework.web.portlet-3.0.1.RELEASE-A.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/org.springframework.web.servlet-3.0.1.RELEASE-A.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/org.springframework.web.struts-3.0.1.RELEASE-A.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/persistence.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/asm-3.3.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/asm-commons-3.3.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/asm-tree-3.3.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-fileupload-1.2.2.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-io-2.0.1.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/commons-lang3-3.1.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/freemarker-2.3.19.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/javassist-3.11.0.GA.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/ognl-3.0.5.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/struts2-core-2.3.4.jar" sourcepath="F:/Java/SSH Source/struts-2.3.4/src/core/src/main"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/xwork-core-2.3.4.jar"/>
	<classpathentry kind="lib" path="WebRoot/WEB-INF/lib/mysql-connector-java-5.1.7-bin.jar"/>
	<classpathentry kind="output" path="WebRoot/WEB-INF/classes"/>
</classpath>
package org.zbq.bean;

public class User {
	private int id;
	private String firstName;
	private String lastName;
	private int age;
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getFirstName() {
		return firstName;
	}
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}
	public String getLastName() {
		return lastName;
	}
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
	public int getAge() {
		return age;
	}
	public void setAge(int age) {
		this.age = age;
	}
	@Override
	public String toString() {
		return "ID: " + id + "FirstName: " + firstName;
	}
}
User.hbm.xml

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-mapping PUBLIC
          "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
          "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
	<class name="org.zbq.bean.User" table="User">
		<id name="id" type="int">
			<generator class="increment"></generator>
		</id>
		
		<property name="firstName" column="firstName" type="string"></property>
		<property name="lastName" column="lastName" type="string"></property>
		<property name="age" column="age" type="int"></property>
		
	</class>
</hibernate-mapping>
UserDAO.java (Interface)

package org.zbq.dao;

import java.util.List;

import org.zbq.bean.User;

public interface UserDAO {
	public void doCreateUser(User user);
	public List<User> findAllUsers();
	public void removeUser(User user);
	public void updateUser(User user);
	public User findUserById(int id);
}
UserDAOImpl.java

package org.zbq.dao.impl;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.zbq.bean.User;
import org.zbq.dao.UserDAO;

public class UserDAOImpl extends HibernateDaoSupport implements UserDAO {

	public void doCreateUser(User user) {
		this.getHibernateTemplate().save(user);
	}

	@SuppressWarnings("unchecked")
	public List<User> findAllUsers() {
		String hql = "from User u order by u.id asc";
		List<User> list = this.getHibernateTemplate().find(hql);
		return list;
	}

	public void removeUser(User user) {
		this.getHibernateTemplate().delete(user);
	}

	public void updateUser(User user) {
		this.getHibernateTemplate().update(user);
	}

	public User findUserById(int id) {
		User user = null;
		user = (User) this.getHibernateTemplate().get(User.class, id);
		return user;
	}
	
}

UserService.java (Interface)

package org.zbq.service;

import java.util.List;

import org.zbq.bean.User;

public interface UserService {
	public void doCreateUser(User user);
	public List<User> findAllUsers();
	public void delete(User user);
	public void update(User user);
	public User findUserById(int id);
}
UserServiceImpl
package org.zbq.service.impl;

import java.util.List;

import org.zbq.bean.User;
import org.zbq.dao.UserDAO;
import org.zbq.service.UserService;

public class UserServiceImpl implements UserService {
	private UserDAO dao;
	
	public UserDAO getDao() {
		return dao;
	}

	public void setDao(UserDAO dao) {
		this.dao = dao;
	}

	public void doCreateUser(User user) {
		this.dao.doCreateUser(user);
	}

	public List<User> findAllUsers() {
		return this.dao.findAllUsers();
	}

	public void delete(User user) {
		this.dao.removeUser(user);
	}

	public void update(User user) {
		this.dao.updateUser(user);
	}

	public User findUserById(int id) {
		return this.dao.findUserById(id);
	}

}
关于User的Action

SaveUserAction.java

package org.zbq.action.user;

import org.zbq.bean.User;
import org.zbq.service.UserService;

import com.opensymphony.xwork2.ActionSupport;

public class SaveUserAction extends ActionSupport {
	private User user;
	private UserService userService;
	
	public UserService getUserService() {
		return userService;
	}

	public void setUserService(UserService userService) {
		this.userService = userService;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Override
	public String execute() throws Exception {
//		调用service相关的方法,完成实际的业务处理
		this.userService.doCreateUser(user);
		return SUCCESS ;
	}
}
ListUserAction.java

package org.zbq.action.user;

import java.util.Map;

import org.zbq.service.UserService;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class ListUserAction extends ActionSupport {
	private UserService userService;

	public UserService getUserService() {
		return userService;
	}

	public void setUserService(UserService userService) {
		this.userService = userService;
	}
	
	@SuppressWarnings("unchecked")
	@Override
	public String execute() throws Exception {
		
		Map request = (Map) ActionContext.getContext().get("request");
		
		request.put("list", this.userService.findAllUsers());
		return SUCCESS;
	}
}
DeleteUserAction.java

package org.zbq.action.user;

import org.zbq.bean.User;
import org.zbq.service.UserService;

import com.opensymphony.xwork2.ActionSupport;

public class DeleteUserAction extends ActionSupport {
	private User user;
	private UserService userService;
	
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public UserService getUserService() {
		return userService;
	}

	public void setUserService(UserService userService) {
		this.userService = userService;
	}

	@Override
	public String execute() throws Exception {
		this.userService.delete(user);
		return SUCCESS;
	}
}
UpdatePUser.java

package org.zbq.action.user;

import org.zbq.bean.User;
import org.zbq.service.UserService;

import com.opensymphony.xwork2.ActionSupport;

public class UpdatePUser extends ActionSupport {
	private User user;
	private UserService userService;
	
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public UserService getUserService() {
		return userService;
	}

	public void setUserService(UserService userService) {
		this.userService = userService;
	}

	@Override
	public String execute() throws Exception {
		this.user = this.userService.findUserById(user.getId());
		
		return SUCCESS;
	}
}
UpdateUserAction.java

package org.zbq.action.user;

import org.zbq.bean.User;
import org.zbq.service.UserService;

import com.opensymphony.xwork2.ActionSupport;

public class UpdateUserAction extends ActionSupport {
	private User user;
	private UserService userService;
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	public UserService getUserService() {
		return userService;
	}
	public void setUserService(UserService userService) {
		this.userService = userService;
	}
	@Override
	public String execute() throws Exception {
		this.userService.update(this.user);
		return SUCCESS;
	}
}
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>
	<package name="ssh2" extends="struts-default">
		<action name="saveUser" class="saveUserAction">
			<result name="success" type="redirect">listUser.action</result>
		</action>
		
		<action name="listUser" class="listUserAction">
			<result name="success">/list.jsp</result>
		</action>
		
		<action name="deleteUser" class="removeUserAction">
			<result name="success" type="redirect">listUser.action</result>
		</action>
		
		<action name="updatePUser" class="updatePUserAction">
			<result name="success">/update.jsp</result>
		</action>
		
		<action name="updateUser" class="updateUserAction">
			<result name="success" type="redirect">listUser.action</result>
		</action>
	</package>
</struts>
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">
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
  
  <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>
  
  <listener>
  	<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>
  
</web-app>
applictionContext.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:p="http://www.springframework.org/schema/p"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
	
	<!-- 想到与Hibernate的hibernate.cfg.xml -->
	<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
		<property name="driverClassName">
			<value>org.gjt.mm.mysql.Driver</value>
		</property>
		
		<property name="url">
			<value>jdbc:mysql://127.0.0.1:3306/ssh</value>
		</property>
		
		<property name="username">
			<value></value>
		</property>
		
		<property name="password">
			<value></value>
		</property>
		
	</bean>

	<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
		<property name="dataSource">
			<ref local="dataSource"/>
		</property>
		
		<property name="mappingResources">
			<list>
				<value>org/zbq/bean/User.hbm.xml</value>					
			</list>
		</property>
		
		<property name="hibernateProperties">
			<props>
				<prop key="hibernate.dialect">
					org.hibernate.dialect.MySQLDialect
				</prop>
				
				<prop key="hibernate.show_sql">
					true
				</prop>
			</props>
		</property>
		
	</bean>
	
	<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
		<property name="sessionFactory">
			<ref local="sessionFactory"/>
		</property>
	</bean>
	
	<bean id="userDAO" class="org.zbq.dao.impl.UserDAOImpl" scope="singleton">
		<property name="sessionFactory">
			<ref local="sessionFactory"/>
		</property>
	</bean>
	
	<bean id="userServiceTarget" class="org.zbq.service.impl.UserServiceImpl" scope="singleton">
		<property name="dao" ref="userDAO" />
	</bean>
	
	<bean id="userService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
		<property name="target">
			<ref local="userServiceTarget"/>
		</property>
		
		<property name="transactionManager">
			<ref local="transactionManager"/>
		</property>
		
		<property name="transactionAttributes">
			<props>
				<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
				<prop key="*">PROPAGATION_REQUIRED</prop>
			</props>
		</property>
	</bean>
	
	<bean id="saveUserAction" class="org.zbq.action.user.SaveUserAction" scope="prototype">
		<property name="userService" ref="userService"></property>
	</bean>
	
	<bean id="listUserAction" class="org.zbq.action.user.ListUserAction" scope="prototype">
		<property name="userService" ref="userService"></property>
	</bean>
	
	<bean id="removeUserAction" class="org.zbq.action.user.DeleteUserAction" scope="prototype">
		<property name="userService" ref="userService"></property>		
	</bean>
	
	<bean id="updatePUserAction" class="org.zbq.action.user.UpdatePUser">
		<property name="userService" ref="userService"></property>
	</bean>
	
	<bean id="updateUserAction" class="org.zbq.action.user.UpdateUserAction" scope="prototype">
		<property name="userService" ref="userService"></property>
	</bean>
</beans>



index.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>My JSP 'index.jsp' starting page</title>

  </head>
  
  <body>
	<h1><font color="red">Operation List</font></h1>
	<s:a href="save.jsp">Save User</s:a><br/>
	<s:a href="listUser.action">List Users</s:a>
	
	
  </body>
</html>
list.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'list.jsp' starting page</title>
	<script type="text/javascript">
		function del(){
			if(confirm("Are you sure?")){
				return true;
			}
			return false;
		}
	</script>
  </head>
  
  <body>
    <h1><font color="red">Users List</font></h1>
    <s:a href="/ssh2/index.jsp"><<--</s:a>
    <table border="1" width="80%" align="center">
    	<tr>
    		<th>序号</th>
    		<th>姓</th>
    		<th>名</th>
    		<th>年龄</th>
    		<th>删除</th>
    		<th>更新</th>
    	</tr>
    	
    	<s:iterator value="#request.list" id="us">
    		<tr>
    			<td>
    				<s:property value="#us.id"/>
    			</td>
    			<td>
    				<s:property value="#us.firstName"/>
    			</td>
    			<td>
    				<s:property value="#us.lastName"/>
    			</td>
    			<td>
    				<s:property value="#us.age"/>
    			</td>
    			<td align="center">
					<s:a href="deleteUser.action?user.id=%{#us.id}" onclick="return del()">Delete</s:a>
    			</td>
    			<td align="center">
					<s:a href="updatePUser.action?user.id=%{#us.id}">Update</s:a>		
    			</td>
    		</tr>
    	</s:iterator>
    </table>
    
  </body>
</html>
save.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>My JSP 'index.jsp' starting page</title>

  </head>
  
  <body>
	<h1><font color="red">Save User</font></h1>
		
	<s:form action="saveUser">
		<s:textfield name="user.firstName" label="First Name"></s:textfield>
		<s:textfield name="user.lastName" label="Last Name"></s:textfield>
		<s:textfield name="user.age" label="Age"></s:textfield>
		<s:submit></s:submit>
	</s:form>
	
  </body>
</html>
update.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'update.jsp' starting page</title>

  </head>
  
  <body>
	<h1><font color="red">Update User</font></h1>
	
	<s:form action="updateUser">
	<table>
		<tr>
			<td>
				<s:hidden name="user.id" value="%{user.id}"></s:hidden>
			</td>
		</tr>
	
		<tr>
			<td>
				<s:textfield name="user.firstName" value="%{user.firstName}" label="First Name"></s:textfield>
			</td>
		</tr>
		
		<tr>
			<td>
				<s:textfield name="user.lastName" value="%{user.lastName}" label="Last Name"></s:textfield>
			</td>
		</tr>
		
		<tr>
			<td>
				<s:textfield name="user.age" value="%{user.age}" label="Age"></s:textfield>
			</td>
		</tr>
		
		<tr>
			<td>
				<s:submit></s:submit>
			</td>
		</tr>
	</table>	
	</s:form>
	
  </body>
</html>


分享到:
评论

相关推荐

    SSH2项目增删改查事例

    在这个"SSH2项目增删改查事例"中,我们可以深入理解如何利用SSH2框架来实现数据库操作的基本功能。 1. **Struts2**:Struts2作为MVC框架,负责处理HTTP请求并分发到相应的Action类,它是业务逻辑的入口。在增删改查...

    SSH整合增删改查全部

    在本例子中,SSH整合被用于实现数据库的增删改查功能,并且包括了搭建SSH框架所需的jar包和详细步骤。 首先,SSH整合的准备工作包括下载并导入这三大框架的相应库文件,通常这些库会被打包到项目的lib目录下。在...

    ssh整合开发实现的增删改查功能

    SSH整合开发实现的增删改查功能是Java Web开发中常见的应用场景,SSH指的是Struts2、Spring和Hibernate三个开源框架的组合。这三个框架在企业级应用开发中扮演着重要角色,帮助开发者构建高效、可维护的Web应用。...

    SSH2登陆增删改查

    SSH2登陆增删改查是Java Web开发中的一个经典应用场景,它涵盖了Struts2、Spring和Hibernate这三个核心框架的整合使用。Struts2作为表现层框架,负责处理HTTP请求和响应,提供MVC(Model-View-Controller)设计模式...

    SSH整合的增删改查完整源码

    SSH整合的增删改查完整源码是一套基于Spring、Struts和Hibernate三大开源框架集成的Web应用开发示例,旨在帮助初学者或开发者快速理解并掌握如何在Java环境中实现数据的CRUD(创建、读取、更新和删除)操作。...

    SSH案例(增删改查)

    这个压缩包中的"SSH案例(增删改查)"显然是一个教学或实践项目,旨在帮助初学者理解如何使用SSH框架进行基本的数据操作:增加、删除、修改和查询。 首先,Struts作为MVC框架的核心,负责处理HTTP请求并调度控制...

    ssh框架整合增删改查项目源码

    这个项目源码提供了一个基础的增删改查应用实例,适合初学者了解SSH框架如何协同工作。 **Spring框架**是核心的依赖注入(DI)和面向切面编程(AOP)容器,它负责管理应用对象的生命周期和依赖关系。在SSH整合中,...

    SSH2 整合简单增删改查实例,仅供学习使用

    总结来说,这个SSH2整合的简单增删改查实例,旨在帮助初学者理解如何将Spring、Struts2和Hibernate协同工作,以及如何利用Gson和Ajax实现前后端的数据交互。通过对这些技术的实践,开发者能够更好地掌握Java Web开发...

    ssh的简单增删改查

    这个“ssh的简单增删改查”示例旨在演示如何在Web应用中利用SSH框架进行基本的数据操作。在这个小例子中,我们将探讨SSH框架的核心概念以及如何通过Ajax技术实现异步的删除操作。 1. **Struts**:Struts是一个MVC...

    SSH 整合实现增删改查

    下面我们将详细探讨SSH整合实现增删改查的相关知识点。 1. **Spring框架**:Spring是核心的依赖注入(DI)和面向切面编程(AOP)框架,提供事务管理、数据库连接池、缓存等服务。在SSH整合中,Spring负责控制反转...

    基于SSH2的增删改查及分页完整项目

    这个"基于SSH2的增删改查及分页完整项目"提供了一个全面的示例,帮助开发者理解如何在实际应用中实现数据的增、删、改、查操作以及分页功能。 **Struts2** 是一个MVC(Model-View-Controller)框架,负责处理HTTP...

    ssh整合的增删改查的完整小例子

    在这个"ssh整合的增删改查的完整小例子"中,我们可以深入理解这三个框架如何协同工作,实现数据操作的核心功能。 首先,Spring作为核心的依赖注入(DI)和面向切面编程(AOP)框架,它负责管理应用程序的组件,包括...

    ssh实现简单增删改查

    在这个“ssh实现简单增删改查”的案例中,我们将深入理解这三个框架如何协同工作来完成基本的数据操作。 **Struts2** 是一个基于MVC(Model-View-Controller)设计模式的Web应用框架,它简化了开发过程,提供了丰富...

    SSH整合练习增删改查

    在本项目"SSH整合练习增删改查"中,开发者使用了Struts2.1.8、Hibernate3.5.5和Spring3.0.2这三个特定版本的框架,以及MySQL5.1数据库和JDK1.6作为运行环境,实现了对数据对象的完整生命周期管理,包括添加(Add)、...

    SSH整合实现增删改查

    SSH整合实现增删改查是Java Web开发中的一个重要概念,主要指的是Spring、Struts和Hibernate三个开源框架的集成应用。这三个框架分别负责控制层、视图层和持久层的管理,通过整合,可以构建出高效、灵活的企业级应用...

    ssh整合增删改查实例

    在这个实例中,我们将深入探讨如何通过SSH整合实现数据的增删改查操作。 首先,Spring作为核心容器,负责管理应用对象(如DAO、Service等)以及依赖注入(DI)。在配置文件中,我们需要定义Bean,并通过@Autowired...

    SSH整合用户注册 登录 增删改查

    java web SSH入门练习资源,整合用户注册 登录 增删改查。

    基于ssh实现增删改查

    在这个主题中,“基于SSH实现增删改查”指的是利用这三个框架协同工作来实现数据库的基本操作:添加(Add)、删除(Delete)、修改(Update)和查询(Query)。下面将详细探讨SSH框架各自的职责以及如何在实际开发中...

    ssh 框架增删改查小项目(CRUD)

    在这个"ssh 框架增删改查小项目(CRUD)"中,我们可以深入学习SSH框架如何实现基本的数据操作,包括创建(Create)、读取(Read)、更新(Update)和删除(Delete)。 Spring框架作为基础,它是一个全面的后端应用...

Global site tag (gtag.js) - Google Analytics