?程序員小王的博客:程序員小王的博客
? 歡迎點(diǎn)贊 ? 收藏 ?留言 ?
? 如有編輯錯(cuò)誤聯(lián)系作者,如果有比較好的文章歡迎分享給我,我會(huì)取其精華去其糟粕
?java自學(xué)的學(xué)習(xí)路線:java自學(xué)的學(xué)習(xí)路線
該項(xiàng)目主要是完成Spring+SpringMVC+mybatis的完整整合,功能實(shí)現(xiàn)比較單一,就是一個(gè)完成增刪改查的小項(xiàng)目!
源代碼在githee倉(cāng)庫(kù):SSM實(shí)戰(zhàn)項(xiàng)目:人事管理系統(tǒng)(藍(lán)色版)
管理員的登錄,注冊(cè),員工的增刪改查,批量刪除,整個(gè)系統(tǒng)設(shè)計(jì)的目標(biāo)人群是管理者,系統(tǒng)的主要功能是對(duì)員工進(jìn)行各種信息的操作。主要是完成對(duì)數(shù)據(jù)庫(kù)的增刪改查的功能。
分類 | 名稱 | 語(yǔ)種 |
---|---|---|
操作系統(tǒng) | windows10 | 簡(jiǎn)體中文 |
數(shù)據(jù)庫(kù)平臺(tái) | MySQL Server 8.0+ | |
應(yīng)用服務(wù)器 | apache-tomcat-8.5.71 | |
java開(kāi)發(fā)工具 | idea | |
框架 | mybatis+Spring+SpringMVC | |
項(xiàng)目名稱 | 《學(xué)生教務(wù)系統(tǒng)》 | |
實(shí)現(xiàn)技術(shù) | mybatis+Spring+SpringMVC+mysql+Servlet+jquery+bootStrap+js+Maven+tomcat等技術(shù) |
-- 創(chuàng)建員工表create table t_emp(id int primary key auto_increment,name varchar(20) not null,salary double not null,age int not null)-- 添加員工數(shù)據(jù)insert into t_emp values(null,"王恒杰",20000,21);insert into t_emp values(null,"楊福君",9000,19);-- 查詢員工數(shù)據(jù)select * from t_emp;-- 創(chuàng)建管理員表create table t_admin( id int primary key auto_increment, username varchar(20), password varchar(50))-- 添加數(shù)據(jù)insert into t_admin values(null,"王恒杰","123456");-- 查詢select * from t_admin
<dependency> <groupId>junitgroupId> <artifactId>junitartifactId> <version>4.11version> <scope>testscope> dependency> <dependency> <groupId>org.springframeworkgroupId> <artifactId>spring-coreartifactId> <version>4.3.2.RELEASEversion> dependency> <dependency> <groupId>org.springframeworkgroupId> <artifactId>spring-contextartifactId> <version>4.3.2.RELEASEversion> dependency> <dependency> <groupId>org.springframeworkgroupId> <artifactId>spring-context-supportartifactId> <version>4.3.2.RELEASEversion> dependency> <dependency> <groupId>org.springframeworkgroupId> <artifactId>spring-jdbcartifactId> <version>4.3.2.RELEASEversion> dependency> <dependency> <groupId>org.springframeworkgroupId> <artifactId>spring-aopartifactId> <version>4.3.2.RELEASEversion> dependency> <dependency> <groupId>org.springframeworkgroupId> <artifactId>spring-beansartifactId> <version>4.3.2.RELEASEversion> dependency> <dependency> <groupId>org.springframeworkgroupId> <artifactId>spring-expressionartifactId> <version>4.3.2.RELEASEversion> dependency> <dependency> <groupId>org.springframeworkgroupId> <artifactId>spring-aspectsartifactId> <version>4.3.2.RELEASEversion> dependency> <dependency> <groupId>org.springframeworkgroupId> <artifactId>spring-txartifactId> <version>4.3.2.RELEASEversion> dependency> <dependency> <groupId>org.springframeworkgroupId> <artifactId>spring-webartifactId> <version>4.3.2.RELEASEversion> dependency> <dependency> <groupId>org.springframeworkgroupId> <artifactId>spring-webmvcartifactId> <version>4.3.2.RELEASEversion> dependency> <dependency> <groupId>javax.servletgroupId> <artifactId>servlet-apiartifactId> <version>2.5version> <scope>providedscope> dependency> <dependency> <groupId>javax.servlet.jspgroupId> <artifactId>jsp-apiartifactId> <version>2.1version> dependency> <dependency> <groupId>jstlgroupId> <artifactId>jstlartifactId> <version>1.2version> dependency> <dependency> <groupId>mysqlgroupId> <artifactId>mysql-connector-javaartifactId> <version>8.0.16version> dependency> <dependency> <groupId>org.mybatisgroupId> <artifactId>mybatisartifactId> <version>3.4.6version> dependency> <dependency> <groupId>org.mybatisgroupId> <artifactId>mybatis-springartifactId> <version>1.3.1version> dependency>
<context:component-scan base-package="com.tjcu.whj">context:component-scan> <context:property-placeholder location="classpath:jdbc.properties">context:property-placeholder> <bean class="com.alibaba.druid.pool.DruidDataSource" name="dataSource"> <property name="driverClassName" value="${jdbc.driver}">property> <property name="url" value="${jdbc.url}">property> <property name="username" value="${jdbc.username}">property> <property name="password" value="${jdbc.password}">property> bean> <bean class="org.mybatis.spring.SqlSessionFactoryBean" id="sqlSessionFactory"> <property name="dataSource" ref="dataSource">property> <property name="mapperLocations" value="classpath:com/tjcu/mapper/*DaoMapper.xml">property> <property name="typeAliasesPackage" value="com.tjcu.whj.entity">property> bean> <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory">property> <property name="basePackage" value="com.tjcu.whj.dao">property> bean> <bean class="org.springframework.jdbc.datasource.DataSourceTransactionManager" id="transactionManager"> <property name="dataSource" ref="dataSource">property> bean> <tx:annotation-driven transaction-manager="transactionManager">tx:annotation-driven>
<context:component-scan base-package="com.tjcu.whj">context:component-scan> <mvc:annotation-driven/> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/">property> <property name="suffix" value=".jsp">property> bean> <mvc:default-servlet-handler/>
功能模塊:登錄,注冊(cè),注銷,密碼加密
注冊(cè)示意圖
登錄示意圖
public interface AdminDao { /** * 登錄 * @param admin * @return */ public Admin login(Admin admin); /** * 注冊(cè) * @param admin */ public void register(Admin admin);}
public interface AdminService { /** * 登錄 * @param admin * @return */ public Admin login(Admin admin); /** * 注冊(cè) * @param admin */ public void register(Admin admin);}
@Service("adminService")@Transactionalpublic class AdminServiceImpl implements AdminService { @Autowired private AdminDao adminDao; @Override public Admin login(Admin admin) { return adminDao.login(admin); } @Override public void register(Admin admin) { adminDao.register(admin); }}
public class AdminTest { @Test public void login(){ ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); AdminService adminService = (AdminService) context.getBean("adminService"); Admin admin = new Admin(null,null, "王恒杰", "123456",true); Admin login = adminService.login(admin); System.out.println(login); } @Test public void register(){ ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); AdminService adminService = (AdminService) context.getBean("adminService"); Admin admin = new Admin(null, "風(fēng)犬少年","鄧正武", "234567",true); adminService.register(admin); }}
@Controller("adminController")@RequestMapping("admin")public class AdminController { /** * 將adminService到AdminController中 */ @Autowired private AdminService adminService; /** * 登錄 * @param admin * @return */ @RequestMapping("login") public String login(Admin admin,HttpServletRequest request){ String password = MD5Utils.md5(admin.getPassword()); admin.setPassword(password); Admin admin1 = adminService.login(admin); System.out.println(admin1); if(admin1!=null){ request.getSession().setAttribute("admin",admin1); return "redirect:/emp/show"; } return "redirect:/login.jsp"; } /** * 注冊(cè) * @param admin */ @RequestMapping("register") public String register(Admin admin){ String password = MD5Utils.
文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請(qǐng)注明本文地址:http://m.specialneedsforspecialkids.com/yun/124037.html
摘要:前言由于寫的文章已經(jīng)是有點(diǎn)多了,為了自己和大家的檢索方便,于是我就做了這么一個(gè)博客導(dǎo)航。 前言 由于寫的文章已經(jīng)是有點(diǎn)多了,為了自己和大家的檢索方便,于是我就做了這么一個(gè)博客導(dǎo)航。 由于更新比較頻繁,因此隔一段時(shí)間才會(huì)更新目錄導(dǎo)航哦~想要獲取最新原創(chuàng)的技術(shù)文章歡迎關(guān)注我的公眾號(hào):Java3y Java3y文章目錄導(dǎo)航 Java基礎(chǔ) 泛型就這么簡(jiǎn)單 注解就這么簡(jiǎn)單 Druid數(shù)據(jù)庫(kù)連接池...
摘要:我覺(jué)得了解簡(jiǎn)歷和面試的技巧可以幫助你更好的去學(xué)習(xí)重要的知識(shí)點(diǎn)以及更好地去準(zhǔn)備面試以及面試,說(shuō)實(shí)話,我個(gè)人覺(jué)得這些東西還挺重要的。在本文里,我將介紹我這段時(shí)間里更新簡(jiǎn)歷和面試的相關(guān)經(jīng)歷。 分享一篇很不錯(cuò)的文章!本文作者曾經(jīng)寫過(guò)《Java Web輕量級(jí)開(kāi)發(fā)面試教程》和 《Java核心技術(shù)及面試指南》這兩本書。我覺(jué)得了解簡(jiǎn)歷和面試的技巧可以幫助你更好的去學(xué)習(xí)重要的知識(shí)點(diǎn)以及更好地去準(zhǔn)備面試以...
摘要:設(shè)置和其中密鑰需要自己生成,和支付寶網(wǎng)關(guān)是已經(jīng)給好的,網(wǎng)關(guān)有字樣,表明是用于開(kāi)發(fā)測(cè)試。上面就是將阿里支付寶支付整合到的全過(guò)程了,如果還有什么疑問(wèn),可以留言或者私信我源代碼下載鏈接密碼 文章有不當(dāng)之處,歡迎指正,如果喜歡微信閱讀,你也可以關(guān)注我的微信公眾號(hào):好好學(xué)java,獲取優(yōu)質(zhì)學(xué)習(xí)資源。 一、支付寶測(cè)試環(huán)境代碼測(cè)試 1.下載電腦網(wǎng)站的官方demo: 下載地址:https://docs...
閱讀 2580·2021-11-22 09:34
閱讀 947·2021-11-19 11:34
閱讀 2807·2021-10-14 09:42
閱讀 1488·2021-09-22 15:27
閱讀 2391·2021-09-07 09:59
閱讀 1741·2021-08-27 13:13
閱讀 3437·2019-08-30 11:21
閱讀 779·2019-08-29 18:35