SSM框架下实现登录注册

本文档介绍了在SSM框架下如何实现登录注册功能。首先确保基础配置为jdk1.8、Tomcat 8和MyEclipse。接着配置spring的application.xml和springMVC配置文件,以及web.xml。接着创建pojo包中的UserInfo类,mapper层的ShopMapping.java及对应的Shop.xml文件。在service层和服务实现层完成业务逻辑,最后在controller层处理注册和登录请求,其中登录时利用HttpSession设置session。
摘要由CSDN通过智能技术生成

基本配置:jdk1.8   tomcat 8  MyEclipse

先打好地基

                  

 

 

spring配置文件 application.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" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:mvc="http://www.springframework.org/schema/mvc"
	xsi:schemaLocation="
     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
     http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
     http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
     http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
     http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
     http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
	<!-- 通过注解,将Service的生命周期纳入Spring的管理 -->
	<context:annotation-config />
	<!-- 通过注解,将Service的生命周期纳入Spring的管理 -->
	<context:component-scan base-package="service"></context:component-scan>
	<bean id="dataSource"
		class="org.springframework.jdbc.datasource.DriverManagerDataSource">

		<!-- 配置数据源 -->
		<property name="driverClassName">
			<value>com.microsoft.sqlserver.jdbc.SQLServerDriver</value>
		</property>

		<property name="url">
			<value>jdbc:sqlserver://localhost:1433;DatabaseName=Organic
			</value>
		</property>

		<property name="username">
			<value>sa</value>
		</property>

		<property name="password">
			<value>123456</value>
		</property>

	</bean>
	<!-- 扫描存放SQL语句的Shop.xml -->
	<bean id="sqlSession" class="org.mybatis.spring.SqlSessionFactoryBean">
		<property name="typeAliasesPackage" value="pojo"></property>
		<property name="dataSource" ref="dataSource"></property>
		<property
  • 10
    点赞
  • 85
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值