尚硅谷大数据技术之电信客服
- 创建包结构,根包:com.atguigu
表13
bean
contants
controller
dao
entries - 类表
表14
类名 备注
CallLog 用于封装数据分析结果的JavaBean
Contact 用于封装联系人的JavaBean
Contants 常量类
CallLogHandler 用于处理请求的Controller
CallLogDAO 查询某人某个维度通话记录的DAO
ContactDAO 查询联系人的DAO
QueryInfo 用于封装向服务器发来的请求参数 - web目录结构,web部分的根目录:webapp
表15
文件夹名 备注
css 存放css静态资源的文件夹
html 存放html静态资源的文件夹
images 存放图片静态资源文件夹
js 存放js静态资源的文件夹
jsp 存放jsp页面的文件夹
WEB-INF 存放web相关配置的文件夹
-
resources目录下创建spring相关配置文件
dbconfig.properties:用于存放数据库连接配置
user=root
password=000000
jdbcUrl=jdbc:mysql://hadoop102:3306/db_telecom?useUnicode=true&characterEncoding=UTF-8
driverClass=com.mysql.jdbc.Driver
applicationContext.xml:Spring&SpringMVC配置
<?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"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
<context:property-placeholder location="classpath:dbconfig.properties"/><bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="user" value="{password}"/>
<property name="driverClass" value="{jdbcUrl}"/>
</bean>
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<constructor-arg name="dataSource" value="#{dataSource}"></constructor-arg>
</bean><bean id="namedParameterJdbcTemplate" class="org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate">
<constructor-arg name="dataSource" value="#{dataSource}"></constructor-arg>
</bean>
<context:component-scan base-package="com.atguigu.controller"></context:component-scan>
<context:component-scan base-package="com.atguigu.dao"></context:component-scan>
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/"/>
<property name="suffix" value=".jsp"/>
</bean>
</beans>
本教程由尚硅谷教育大数据研究院出品,如需转载请注明来源,欢迎大家关注尚硅谷公众号(atguigu)了解更多。