`
knight_black_bob
  • 浏览: 850997 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

struts+spring +jdbctemplate demo

阅读更多

 

源码下载 :http://download.csdn.net/download/knight_black_bob/9332935

 

 



 

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:javaee="http://java.sun.com/xml/ns/javaee"
	xmlns:jsp="http://java.sun.com/xml/ns/javaee/jsp" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
	id="WebApp_9" version="2.4">

	<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>


	<filter>
		<filter-name>struts2</filter-name>
		<!-- org.apache.struts2.dispatcher.FilterDispatcher -->
		<!-- org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter -->
		<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
	</filter>
	<filter-mapping>
		<filter-name>struts2</filter-name>
		<url-pattern>*.action</url-pattern>
	</filter-mapping>


</web-app>

 

 

jdbc.properties

jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/database
jdbc.username=root
jdbc.password=root

 

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:tx="http://www.springframework.org/schema/tx"
	xsi:schemaLocation="
			http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
			http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
			http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"
	default-autowire="byName">


	<!-- 加载DB配置文件 -->
	<bean
		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
		<property name="locations" value="classpath:jdbc.properties"></property>
	</bean>

	<!--第一个数据源,采用XAPool链接池 -->
	<bean id="dataSource" class="org.enhydra.jdbc.pool.StandardXAPoolDataSource"
		destroy-method="shutdown">
		<property name="dataSource">
			<bean class="org.enhydra.jdbc.standard.StandardXADataSource"
				destroy-method="shutdown">
				<!-- <property name="transactionManager" ref="jotm" /> -->
				<property name="driverName" value="${jdbc.driverClassName}" />
				<property name="url" value="${jdbc.url}" />
			</bean>
		</property>
		<property name="user" value="${jdbc.username}" />
		<property name="password" value="${jdbc.password}" />
	</bean>

	<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
		<property name="dataSource" ref="dataSource" />
	</bean>

</beans>

 applicationContext-action.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:tx="http://www.springframework.org/schema/tx"
		xsi:schemaLocation="
			http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
			http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
			http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"
	default-autowire="byName"		
	>
	
	<!-- <bean id="otherUserAction" class="com.fusionability.user.action.OtherUserAction" scope="prototype"></bean> -->
	
	<bean id="userAction" class="com.bp.user.action.UserAction" scope="prototype"></bean>
	
</beans>

 applicationContext-dao.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:tx="http://www.springframework.org/schema/tx"
	xsi:schemaLocation="
			http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
			http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
			http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"
	default-autowire="byName">


	<!-- <bean id="activationDao" class="com.fusionability.user.dao.impl.ActivationDaoImpl"> 
		<property name="jdbcTemplate" ref="jdbcTemplateFusionWeb" /> </bean> -->

	<bean id="userDao" class="com.bp.user.daoImpl.UserDaoImple">
		<property name="jdbcTemplate" ref="jdbcTemplate" />
	</bean>
</beans>

 

applicationContext-service.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:tx="http://www.springframework.org/schema/tx"
	xsi:schemaLocation="
			http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
			http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
			http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"
	default-autowire="byName">

	<!-- <bean id="managerAppService" class="com.fusionability.system.service.impl.ManagerAppServiceImpl"></bean> -->

	<bean id="userService"
		class="com.bp.user.serviceImpl.UserServiceImpl"></bean>

</beans>

 

struts.xml

<?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>

	<constant name="struts.action.extension" value="action" />

	<constant name="struts.i18n.encoding" value="utf-8" />

	<constant name="struts.enable.DynamicMethodInvocation" value="false" />

	<constant name="struts.configuration.xml.reload" value="false" />

	<constant name="struts.devMode" value="true" />

	<include file="struts-interceptor.xml"></include>
	<include file="struts-exception.xml"></include>
	<include file="struts-action-*.xml"></include>

</struts>

 struts-interceptor.xml

<?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>

	<package name="interceptorPackage" extends="struts-default">
		<interceptors>
			<interceptor name="authInterceptor"
				class="com.bp.base.interceptor.AuthInterceptor"></interceptor>
			<interceptor-stack name="myStack">
				<interceptor-ref name="defaultStack"></interceptor-ref>
				<interceptor-ref name="authInterceptor"></interceptor-ref>
			</interceptor-stack>
		</interceptors>
		<default-interceptor-ref name="myStack"></default-interceptor-ref>
	</package>

</struts>

 struts-exception.xml

<?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>



	<package name="exceptionPackage" extends="interceptorPackage">
		<global-results>
			<result name="login" type="redirect">/user/login.jsp</result>
			<result name="error" type="redirect">/user/login.jsp</result>
			<result name="error-500" type="redirect">/user/login.jsp</result>
		</global-results>

		<global-exception-mappings>
			<exception-mapping result="error-500" exception="java.lang.Exception"></exception-mapping>
		</global-exception-mappings>
	</package>

</struts>

 struts-action-user.xml

<?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>

	<package name="userPackage" namespace="/user" extends="exceptionPackage">

		<!-- <action name="sdkDownload" class="sdkDownloadAction"> result的Type必须为stream 
			<result name="success" type="stream"> <param name="contentType"> application/octet-stream;charset=ISO-8859-1 
			</param> <param name="contentDisposition">attachment;fileName="${fileName}"</param> 
			<param name="inputName">downloadFile</param> </result> </action> <action 
			name="otherUserAction" class="otherUserAction" method="toOtherRegPage"> <result 
			name="other_login">/user/other_login.jsp</result> </action> -->


		<action name="userAction" class="userAction" method="login">
			<result name="error">/user/login.jsp</result>
			<result name="success" type="redirect">/user/userListAction.action</result>
		</action>
		<action name="userListAction" class="userAction" method="userList">
			<result name="error">/user/userList.jsp</result>
			<result name="success" >/user/userList.jsp</result>
		</action>
		<action name="toeditAction" class="userAction" method="toedit">
			<result name="success" >/user/editUser.jsp</result>
		</action>
		<action name="editAction" class="userAction" method="edit">
			<result name="success" type="redirect">/user/userListAction.action</result>
			<result name="error" type="redirect">/user/toeditAction.action?id=${id}</result>
		</action>
		<action name="deleteAction" class="userAction" method="delete">
			<result name="success" type="redirect">/user/userListAction.action</result>
		</action>
		<action name="toaddAction" class="userAction" method="toAdd">
			<result name="success" >/user/addUser.jsp</result>
		</action>
		<action name="addAction" class="userAction" method="add">
			<result name="error" >/user/addUser.jsp</result>
			<result name="success" type="redirect">/user/userListAction.action</result>
		</action>


	</package>
</struts>

 UserAction

package com.bp.user.action;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.ui.ModelMap;

import com.bp.base.action.BaseAction;
import com.bp.entity.User;
import com.bp.user.service.UserService;

public class UserAction extends BaseAction {
	private static Logger logger = Logger.getLogger(UserAction.class);
	public UserService userService;
	public User user;
	
	public int id;
	
	
	
	public String  login(){
		
		User user1 = userService.findUserByNameAndPoss(user);
		if(null == user1){
			return "error";
		}
			return "success";
	}
	
	public String userList(){
		List <User> users = userService.findAllUsers();
		logger.info("users:"+users);
		getRequest().setAttribute("users", users);
		//getSession().setAttribute("users", users);
		return "success";
	}
	
	public String toedit(){
		User user1 = userService.findUserById(new User(this.id));
		System.out.println(user1);
		getRequest().setAttribute("user", user1);
		
		return "success";
	}
	
	public String edit(){
		logger.info("user:"+user.toString());
		boolean flag = userService.updateUser(user);
		
		if(!flag){
			getRequest().setAttribute("id", user.getId());
			return "error";
		}
		return "success";
	}
	
	public String delete(){
		boolean flag = userService.deleteUser(new User(id));
		return "success";
	}
	
	public String toAdd(){
		return "success";
	}
	public String add(){
		
		User user1 = userService.addUser(user);
		if(null == user1){
			return "error";
		}
		return "success";
	}

	@Override
	public String execute() throws Exception {
		return super.execute();
	}
	
	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;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}
	

}

 

User

package com.bp.entity;

import java.io.Serializable;

@SuppressWarnings("serial")
public class User implements Serializable {

	private int id;
	private String userName;
	private String password;

	public User() {

	}

	public User(int id) {
		this.id = id;
	}

	public User(String userName, String password) {
		this.userName = userName;
		this.password = password;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@Override
	public String toString() {
		return "User [id=" + id + ", userName=" + userName + ", password=" + password + "]";
	}

}

 

UserDao

package com.bp.user.dao;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.bp.entity.User;


public interface UserDao {
	
	public int addUser(User user);
	public User findUserById(User user);
	public User findUserByName(User user);
	public List<User> findAllUsers();
	public int updateUser(User user);
	public int deleteUser(User user);
	public User findUserByNameAndPoss(User user);
	
	
	
}

 

UserDaoImple

package com.bp.user.daoImpl;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Repository;

import com.bp.entity.User;
import com.bp.user.dao.UserDao;
public class UserDaoImple implements UserDao {

	private JdbcTemplate jdbcTemplate;


	@Override
	public int addUser(User user) {
		String addSql = "insert into user (userName,password) values(?,?)";
		int rs = jdbcTemplate.update(addSql, new Object[]{user.getUserName(),user.getPassword()});
		return rs ;
	}

	@Override
	public User findUserById(User user) {
		String selectSql = "select * from user where id= ?";
		List<User> users = jdbcTemplate.query(selectSql,new Object[]{user.getId()}, new UserRowMap());
		
		return null != users  && users.size() != 0 ? users.get(0) : null;
	}

	@Override
	public User findUserByName(User user) {
		String selectSql = "select * from user where userName= ?";
		List<User> users = jdbcTemplate.query(selectSql,new Object[]{user.getUserName()}, new UserRowMap());
		
		return null != users  && users.size() != 0 ? users.get(0) : null;
	}

	@Override
	public List<User> findAllUsers() {
		String selectSql = "select * from user";
		List<User> users = jdbcTemplate.query(selectSql, new UserRowMap());
		
		return users;
	}

	@Override
	public int updateUser(User user) {
		String addSql = "update user set user.password = ?,user.userName = ? where user.id = ?";
		int rs = jdbcTemplate.update(addSql, new Object[]{user.getPassword(),user.getUserName(),user.getId()});
		return rs ;
	}

	@Override
	public int deleteUser(User user) {
		String addSql = "delete from user where user.id = ?";
		int rs = jdbcTemplate.update(addSql, new Object[]{user.getId()});
		return rs ;
	}
	
	class UserRowMap implements RowMapper{

		@Override
		public User mapRow(ResultSet rs, int index) throws SQLException {
			User user = new User();

			user.setId(rs.getInt("id"));
			user.setUserName(rs.getString("userName"));
			user.setPassword(rs.getString("password"));
			
			return user;
		}
		
	}

	@Override
	public User findUserByNameAndPoss(User user) {
		String selectSql = "select * from user where user.userName= ? and user.password =?";
		List<User> users = jdbcTemplate.query(selectSql,
				new Object[]{user.getUserName(),user.getPassword()}, 
				new UserRowMap());
		
		return null != users  && users.size() != 0 ? users.get(0) : null;
	}

	public JdbcTemplate getJdbcTemplate() {
		return jdbcTemplate;
	}

	public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
		this.jdbcTemplate = jdbcTemplate;
	}
	

}

 

UserService

package com.bp.user.service;

import java.util.List;

import com.bp.entity.User;

public interface UserService {

	public User addUser(User user);
	public User findUserById(User user);
	public User findUserByName(User user);
	public User findUserByNameAndPoss(User user);
	public List<User> findAllUsers();
	public boolean updateUser(User user);
	public boolean deleteUser(User user);
}

 UserServiceImpl

package com.bp.user.serviceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bp.entity.User;
import com.bp.user.dao.UserDao;
import com.bp.user.service.UserService;

public class UserServiceImpl implements UserService {

	public UserDao userDao;
	
	
	public UserDao getUserDao() {
		return userDao;
	}

	public void setUserDao(UserDao userDao) {
		this.userDao = userDao;
	}

	@Override
	public User addUser(User user) {
		return userDao.addUser(user)>0 ? userDao.findUserByName(user): null;
	}

	@Override
	public User findUserById(User user) {
		return userDao.findUserById(user);
	}

	@Override
	public User findUserByName(User user) {
		return userDao.findUserByName(user);
	}

	@Override
	public List<User> findAllUsers() {
		return userDao.findAllUsers();
	}

	@Override
	public boolean updateUser(User user) {
		return userDao.updateUser(user)>0;
	}

	@Override
	public boolean deleteUser(User user) {
		return userDao.deleteUser(user)>0;
	}

	@Override
	public User findUserByNameAndPoss(User user) {
		return userDao.findUserByNameAndPoss(user);
	}

}

 

BaseAction

package com.bp.base.action;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;

public class BaseAction  extends ActionSupport{

	
	public HttpServletRequest getRequest() {
		return ServletActionContext.getRequest();
	}

	public HttpServletResponse getResponse() {
		return ServletActionContext.getResponse();
	}

	public ServletContext getContext() {
		return ServletActionContext.getServletContext();
	}

	public HttpSession getSession() {
		return getRequest().getSession();
	}
	
}

 

AuthInterceptor

package com.bp.base.interceptor;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

public class AuthInterceptor  extends AbstractInterceptor {

	@Override
	public String intercept(ActionInvocation invocation) throws Exception {
		return invocation.invoke();
	}

}

  

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

捐助开发者

在兴趣的驱动下,写一个免费的东西,有欣喜,也还有汗水,希望你喜欢我的作品,同时也能支持一下。 当然,有钱捧个钱场(右上角的爱心标志,支持支付宝和PayPal捐助),没钱捧个人场,谢谢各位。



 
 
 谢谢您的赞助,我会做的更好!

 

 

  • 大小: 19.6 KB
1
2
分享到:
评论
4 楼 knight_black_bob 2015-12-08  
haoran_10 写道
几年工作经验了


13年毕业的,,
3 楼 haoran_10 2015-12-08  
几年工作经验了
2 楼 knight_black_bob 2015-12-08  
haoran_10 写道
赞一下,哥们现在在哪儿工作?

北京一外包公司。。。。。
1 楼 haoran_10 2015-12-08  
赞一下,哥们现在在哪儿工作?

相关推荐

    struts+spring +jdbctemplate demo

    在这个“Struts+Spring+JdbcTemplate Demo”中,我们将探讨这三个组件如何协同工作,以及它们各自的核心功能。 首先,Struts 是一个基于 Model-View-Controller(MVC)设计模式的开源Java Web框架。它的主要目标是...

    struts2.3.4+spring3.1.1+jdbctemplate

    Struts2.3.4+Spring3.1.1+JdbcTemplate 整合示例 在Web开发领域,Struts2、Spring和JDBC Template是常见的技术栈,它们各自承担着不同的职责。Struts2是一个强大的MVC框架,用于处理用户请求并控制应用流程;Spring...

    Struts+Spring+Hibernate实现的增删查该Demo(不带jar包)

    在整合这三大框架时,通常会使用Spring的`HibernateTemplate`或`JdbcTemplate`来协调Struts和Hibernate的交互,避免直接在Action类中处理数据库操作,保持业务逻辑的纯粹。Spring还能够管理Hibernate的Session,确保...

    基于spring+struts2+springJDBC的轻量级项目demo

    基于spring+struts2+springJDBC编写的轻量级项目 service、dao、action已经写了对应的demo 主要是使用spring的JdbcTemplate和TransactionTemplate

    struts+spring+ibatis整合框架小demo

    这个名为"struts+spring+ibatis整合框架小demo"的项目,旨在提供一个实际操作的示例,帮助开发者理解并掌握这三个框架的集成与应用。 首先,Struts作为MVC框架,主要处理HTTP请求,控制应用程序的流程。它通过...

    struts+spring+ibatis整合示例 demo

    在Struts+Spring+iBatis整合中,通常会使用Spring的JdbcTemplate或MyBatis(iBatis的升级版)来执行SQL。 **整合过程**: 1. **配置Spring**:首先需要配置Spring的ApplicationContext,定义Bean的定义,包括Struts...

    struts+spring

    结合使用Struts和Spring,我们可以通过Spring的依赖注入将JdbcTemplate实例注入到Struts的Action类中,这样Action类就可以在处理登录请求时调用JdbcTemplate的方法来访问数据库。Spring的事务管理功能还可以确保在...

    struts2.3.x+spring3.1.x+hibernate3.6 demo

    十分抱歉,上次整合的是一个半成品,spring3.1和hibernate4.1目前...我这里有测试的demo 基本上大家能看懂! 还有就是我这里习惯把service和dao按照不同的模块进行划分,比较繁琐,但是习惯了! 有意见的请给我留言!

    spring实例(经典推荐)SpringMVCDemo.rar

    通过Spring的HibernateTemplate或JdbcTemplate,开发者可以方便地执行SQL查询,进行数据的CRUD操作。Spring还支持事务管理,确保了数据的一致性和完整性。 在项目结构上,SpringMVCDemo通常包括以下几个关键部分: ...

    iBATIS_Spring_struts_demo.rar_DEMO_Struct spring ibatis_ibatis j

    标题中的“iBATIS_Spring_struts_demo.rar_DEMO_Struct spring ibatis_ibatis j”表明这是一个关于集成iBATIS、Spring和Struts的演示项目。这个DEMO旨在展示如何在Java应用中有效地整合这三个框架,从而实现数据持久...

    spring,hirbernate,struts2,框架整合资源/SSH整合全套案例

    3. 集成Hibernate:Spring可以方便地管理Hibernate的SessionFactory和Session,通过Spring的JdbcTemplate或HibernateTemplate来执行数据库操作。在Spring配置文件中定义SessionFactory,然后配置数据源、实体类、...

    spring2_struts2_jbpm3.2.rar_jbpm struts2_jbpm-demo_jbpm3 spring_

    2. 集成JBPM:通过Spring的JdbcTemplate或JPA实现数据库连接,配置jbpm-datasource.xml文件,确保流程实例的数据存储。 3. 创建Service Bean:实现对JBPM API的封装,如startProcess、completeTask等方法。 4. 配置...

    springboot-hibernate-strruts2_springboot_struts2_hibernate_整合_源码

    在IT行业中,SSH框架是Java Web开发中非常经典且广泛使用的三大框架——Spring、Struts2和Hibernate的组合。这个名为"springboot-hibernate-strruts2_springboot_struts2_hibernate_整合_源码"的压缩包文件,显然...

    ssh2+ext demo例子

    这个"ssh2+ext demo例子"显然提供了一个实际的示例,演示了如何将Struts2、Spring、Hibernate以及EXT.js这四个关键组件集成到一个项目中。下面将详细解释这些技术以及它们在项目中的作用。 首先,Struts2是基于MVC...

    ssh3的demo,清楚的描述了SSH框架搭建过程的各种配置.zip

    此外,Spring还提供了强大的数据访问抽象,如JdbcTemplate和HibernateTemplate,可以方便地与各种数据库进行交互。 Hibernate则是SSH中的持久层框架,专注于对象关系映射(ORM)。它使得Java对象可以直接操作数据库...

    SSJDBC demo

    SSJDBC(Struts Spring JDBC)是一个集成框架,主要用于简化Java Web应用中Struts、Spring和JDBC的整合。这个框架使得在开发过程中能够更好地管理数据访问层,提高代码的可维护性和可重用性。在"SSJDBC demo"项目中...

    ssh_注解demo基于mysql

    - **DAO(Data Access Object)**:SSH框架通常使用Spring的`JdbcTemplate`或`HibernateTemplate`来实现对数据库的操作。DAO接口和实现类可以使用`@Repository`注解进行管理。 - **Service层**:服务层(`@Service`...

    实现登录用户管理功能的demo

    在这个“实现登录用户管理功能的demo”中,我们主要关注以下几个技术点:Spring、Struts2、Spring JDBC Template、ajaxanywhere和jquery。 首先,Spring是一个开源的应用框架,它提供了强大的依赖注入(DI)和面向...

    SSH整合DEMO

    SSH整合DEMO是一个基于Java Web开发的经典组合,涵盖了Struts2、Spring2.0和Hibernate3.0这三个框架的集成示例。这个DEMO旨在帮助开发者理解如何将这些流行的开源框架协同工作,以构建高效、模块化的Web应用程序。 ...

    SSH三大框架登录小实例,以及spring的登录增删改查实例测试

    Spring JDBC模块提供了JdbcTemplate或NamedParameterJdbcTemplate,简化了JDBC代码,使得直接操作SQL变得更加方便。虽然在SSH框架中,我们通常使用Hibernate进行数据库交互,但了解Spring JDBC也是很重要的,因为它...

Global site tag (gtag.js) - Google Analytics