0

【笔记】SSH项目结构

 1 year ago
source link: https://loli.fj.cn/2023/03/17/SSH%E9%A1%B9%E7%9B%AE%E7%BB%93%E6%9E%84/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

【笔记】SSH项目结构

2023-03-17

SSH项目结构学习笔记

+ src
+ com
+ action
- UserAction.java
+ business
+ impl
- UserBusinessImpl.java
- UserBusiness.java
+ dao
+ impl
- UserDaoImpl.java
- UserDao.java
+ orm
+ mapping // 存放`.hbm.xml`映射文件
+ model // 存放`.java`实体类
- hibernate.cfg.xml

src/com/action/UserAction.java

class UserAction extends BaseAction {

private UserBusiness userBusiness;

public UserBusiness setUserBusiness(UserBusiness userBusiness) {
this.userBusiness = userBusiness;
}

}

src/com/business/impl/UserBusinessImpl.java

class UserBusiness extends BaseBusiness {

private UserDao userDao;

public UserDao setUserBusiness(UserDao userDao) {
this.userDao = userDao;
}

}

src/com/business/dao/UserBusinessDao.java

class UserDao extends BaseDao {

}

Bean配置

src/applicationContext-user.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.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">

<!-- Action -->
<bean id="userAction" class="com.action.UserAction">
<property name="userBusiness" ref="userBusiness"/>
</bean>
<!-- Business -->
<bean id="userBusiness" parent="baseBusiness" class="com.business.impl.UserBusinessImpl">
<property name="userDao" ref="userDao"/>
</bean>
<!-- Dao -->
<bean id="userDao" parent="baseDao" class="com.dao.impl.UserDaoImpl"></bean>

</beans>

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK