一次完整请求的日志:
各种配置文件:
spring-mvc.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" rel="nofollow"" target="_blank">http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" rel="nofollow"" target="_blank">http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context" rel="nofollow"" target="_blank">http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop" rel="nofollow"" target="_blank">http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.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">
<mvc:annotation-driven>
<mvc:message-converters>
<bean class="org.springframework.http.converter.ByteArrayHttpMessageConverter"/>
<bean class="org.springframework.http.converter.FormHttpMessageConverter"/>
<bean class="org.springframework.http.converter.xml.SourceHttpMessageConverter"/>
<bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"/>
</mvc:message-converters>
</mvc:annotation-driven>
<!-- 使用annotation 自动注册bean,并保证@Required,@Autowired的属性被注入 -->
<mvc:annotation-driven/>
<context:component-scan base-package="com.commoninfo.user.controller">
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
<aop:aspectj-autoproxy proxy-target-class="true">
<aop:include name="controllerAspect"/>
</aop:aspectj-autoproxy>
<!-- 避免IE执行AJAX时,返回JSON出现下载文件 -->
<!-- 支持JSON数据格式 -->
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<property name="messageConverters">
<list>
<ref bean="mappingJacksonHttpMessageConverter"/>
</list>
</property>
</bean>
<bean id="mappingJacksonHttpMessageConverter"
class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
</bean>
<!-- 对模型视图名称的解析,即在模型视图名称添加前后缀 -->
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/view/"/>
<property name="suffix" value=".jsp"/>
</bean>
<!--处理静态资源-->
<mvc:default-servlet-handler/>
</beans>
spring-mybatis.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" rel="nofollow"" target="_blank">http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" rel="nofollow"" target="_blank">http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" rel="nofollow"" target="_blank">http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<!--引入属性文件-->
<context:property-placeholder location="classpath:/jdbc.properties"/>
<context:component-scan base-package="com.commoninfo.user.service"/>
<!--配置数据源-->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="${database.driver}"/>
<property name="jdbcUrl" value="${database.url}"/>
<property name="user" value="${database.username}"/>
<property name="password" value="${database.password}"/>
<property name="minPoolSize" value="1"/>
<property name="maxPoolSize" value="20"/>
<property name="maxIdleTime" value="1800"/>
<property name="acquireIncrement" value="2"/>
<property name="maxStatements" value="0"/>
<property name="initialPoolSize" value="2"/>
<property name="idleConnectionTestPeriod" value="1800"/>
<property name="acquireRetryAttempts" value="30"/>
<property name="breakAfterAcquireFailure" value="true"/>
<property name="testConnectionOnCheckout" value="false"/>
</bean>
<!--mybatis文件-->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<!--自动扫描entity目录-->
<property name="configLocation" value="classpath:mybatis-config.xml"/>
<property name="mapperLocations" value="classpath*:com/commoninfo/user/**/*.xml"/>
</bean>
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.commoninfo.user.dao"/>
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
</bean>
<!-- 配置事务管理器 -->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<!-- 配置事物的注解方式注入 -->
<tx:annotation-driven transaction-manager="transactionManager"/>
</beans>
web.xml的内容:
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
<!-- Spring-mybatis的配置文件 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring-mybatis.xml</param-value>
</context-param>
<servlet>
<servlet-name>SpringMVC</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring-mvc.xml</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>SpringMVC</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<!--字符过滤器-->
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
</listener>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!--404错误页-->
<error-page>
<error-code>404</error-code>
<location>/WEB-INF/view/404.jsp</location>
</error-page>
</web-app>
index.jsp的内容:
<%--
Created by IntelliJ IDEA.
User: zhulongkun
Date: 2018/3/18
Time: 14:06
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<html>
<head>
<title>登录测试</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div align="center">
<form action="/test/dologin.do" method="post">
<table>
<tr>
<td><label>用户名</label></td>
<td><label>
<input type="text" name="username" style="width: 180px;"/>
</label></td>
</tr>
<tr>
<td><label>密 码</label></td>
<td><label>
<input type="password" name="password" style="width: 180px;"/>
</label></td>
</tr>
<tr>
<td><input type="submit" name="login" value="登录"/></td>
<td><input id="registerBtn" type="button" name="register" value="注册"/></td>
</tr>
</table>
</form>
</div>
</body>
</html>
controller.java:
复制代码
package com.commoninfo.user.controller;
import com.commoninfo.user.entity.User;
import com.commoninfo.user.service.UserService;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
/**
* @author zhulongkun20@163.com
* @date 2018/3/18 13:56
*/
@Controller
@RequestMapping("/test")
public class LoginController {
private static Logger logger = Logger.getLogger(LoginController.class);
@Resource
private UserService userService;
@RequestMapping(value = "/dologin.do")
public String doLogin(HttpServletRequest httpServletRequest, Model model) {
User user = userService.getUsersByUsername(
httpServletRequest.getParameter("username")).get(0);
logger.info("User的信息为:" + user.toString());
if (userService.doUserLogin(user)) {
model.addAttribute("successMsg", "登录成功!");
model.addAttribute("username", user.getUsername());
logger.info("successMsg:" + model.containsAttribute("successMsg"));
logger.info("username:" + model.containsAttribute("username"));
return "success";
} else {
model.addAttribute("failedMsg", "用户名或密码错误!");
logger.info("failedMsg:" + model.containsAttribute("failedMsg"));
return "failed";
}
}
}
一次完整请求的日志
转载于:https://www.cnblogs.com/rtjherty848/p/8601727.html
相关文章:

Aveva Marine C# 二次开发入门001
1# 引用 C:\AVEVA\Marine\OH12.1.SP4\Aveva.ApplicationFramework.dll C:\AVEVA\Marine\OH12.1.SP4\Aveva.ApplicationFramework.Presentation.dll 2# 引用命名空间, using Aveva.ApplicationFramework.Presentation;using Aveva.ApplicationFramework; 3# 继承接口…

搜集《ASP.NET中常用的26个优化性能方法》
1. 数据库访问性能优化 a.数据库的连接和关闭 访问数据库资源需要创建连接、打开连接和关闭连接几个操作。这些过程需要多次与数据库交换信息以通过身份验证,比较耗费服务器资源。ASP.NET中提供了连接池(Connection Pool)改善打开和关闭数据库对性能的影响…

【matlab】我要自学网笔记总结 1.3
1.3 1、在matlab的命令行窗口可以直接进行数学运算 2、π 和平方的使用 S pi*r^2 3、如果输入一个多位小数,输出时只显示小数点后四位,但计算的时候使用的是真实值。 如果要改变显示的位数 (1)可以在 预设 - 命令行窗口 - 数值…

IT规划的企业应用实践(6)研究背景 之 企业信息化建设的诉求
研究背景 之 企业信息化建设的诉求 从实践角度看,企业信息化建设的诸多问题和诉求,可以归纳为以下几个方面: 1. IT系统本身: l 面对成本的压力和客户的要求,在流程方面、运作方面离不开IT支持,IT系统如何支…

Codeforces Gym100812 L. Knights without Fear and Reproach-扩展欧几里得(exgcd)
补一篇以前的扩展欧几里得的题,发现以前写错了竟然也过了,可能数据水??? 这个题还是很有意思的,和队友吵了两天,一边吵一边发现问题??? L. Knights without F…

Tarjan无向图连通性
割点:去掉某点x,该无向图分割成两部分(及以上) 割边:去掉某条边x,该无向图分割成两部分(及以上) 时间戳:在搜索树上的遍历序号dfn 追溯值:subtree子树和非搜索…

php去除字符串首尾空格(包括全角)(转)
<? $str" dfdfdf曊壷顳 道德观第三附属 "; $str mb_ereg_replace(^( | ), , $str); $str mb_ereg_replace(( | )$, , $str); echo mb_ereg_replace( , "\n ", $str); ?>转载于:ht…

【单片机】写电子钟时遇到的问题
1、<> 与""的区别 1、<> 先去系统目录中找头文件,如果没找到再去当前目录下找。 所以一般用于向标准的头文件如 studio.h 和 stdlib.h 等方法。 2、"" 首先在当前目录下寻找,如果找不到在去系统目录下寻找。这个用于自…

什么是业务组件?
海浪给大家分享了一些关于业务组件的文章,但是什么是业务组件呢?海浪转载了yongtree写的这篇文章。业务组件是一系列不可分割的业务活动,是构建专业化企业的功能模块。业务组件的优势在很大程度上来源于其具备两个相关但截然不同的特性&#…

3.3.2 函数参数不得不说的几件事
函数定义时圆括号内是使用逗号分隔开的形式参数列表(parameters),一个函数可以没有参数,但是定义和调用时一对圆括号必须要有,表示这是一个函数并且不接受参数。函数调用时向其传递实参(argumentsÿ…

wpf 对控件进行截图,获取快照
有时候我们项目,在执行某个操作后,会生成一些数据结果,如报表一类的东西,我们需要对结果进行保存,甚至是生成word文档。 那么首先获取到控件快照就最基本的条件。 生成快照的静态方法类 using System; using System.Co…

【java】兴唐第二十一节(LinkedList和泛型)
LinkedList知识点 1、实现了Iterable接口的类具有迭代功能。 2、List接口为Collection的子类,表示线形数据列表,其实现类有:ArrayList(数组线性表)与LinkedList(链表) 算了不多说了,上图吧 3、ArrayList是一个可变数组ÿ…

Elgg网站迁移指南
转载地址: http://blog.sina.com.cn/s/blog_84068de60100vr21.html Elgg官方文档上的网站迁移部分是有问题的——缺少了一些重要步骤,而且过程更麻烦。正确的方法如下: 备份网站文件,包括uploads文件夹导出数据库在数据库文件中&a…

INFO:在InstallShield中修改安装包压缩.cab包的大小
如果我们用InstallShield打包一个数据非常大的安装包(Basic MSI和InstallScript MSI工程类型),默认情况下安装包会产生多个.cab文件,这里简单说明我们如何修改安装包中.cab文件的大小。首先,有个信息大家需要知道&…

MEF依赖注入实例
什么是MEF 先来看msdn上面的解释:MEF(Managed Extensibility Framework)是一个用于创建可扩展的轻型应用程序的库。 应用程序开发人员可利用该库发现并使用扩展,而无需进行配置。 扩展开发人员还可以利用该库轻松地封装代码,避免生成脆弱的硬…

Data - 数据思维 - 上篇
1 - 概念与定义 如果分析思维是一种结构化思考的体现,那么数据分析思维(简称数据思维)则是以数据为依托的结构化分析方式。 不同于“我觉得”、“以前是怎样”、“其他人如何”这些直觉化、经验化、类比化的思考方式,数据思维是以…

新生选课系统使用指南
建议选用IE6或者IE7浏览器。 打开浏览器,地址栏输入202.200.112.200, 或者202.200.112.202, 或者202.200.112.210。按回车键。 输入学号和身份证号(如果修改过密码,则输入新密码)。点“登录”。 点 “学生…

【java】兴唐第二十三节课(暑期第一节TreeSet)
预警:进入暑期培训的博主即将高产似母猪,敬请博友期待。 1、给类添加构造方法 alt shift s 选择Generate Construct using Fields 2、map两种遍历方法 方法一: 获取所有的key值,根据key值获取value值 代码实现: Se…

程序设计分析(开篇)——混沌初开,顿悟设计
一直以来,不断的进行着项目的设计、开发,然而,差的设计,痛苦的维护、编码,让我不断的审视自己的设计是否有问题,在最近的一些思考、理解中,终于有了一些领悟,总结一下过去的设计&…

源代码管理工具调查
任务说明: 一、找出并了解当前较为流行的几种源代码管理工具(至少三种); 1、 Visual Source Safe( 简称 VSS )2、 SVN(Subversion) - CVS(Concurrent Version System)的替代和升级版本3、 ClearCase 二、建立表格对这些源代码管理…

从零开始学Go之接口(一):接口
接口是双方约定的一种合作协议。接口实现者不需要关心接口会被怎样使用,调用者也不需要关心接口的实现细节。 接口是一种类型,也是一种抽象结构,不会暴露所含数据的格式、类型及结构。 声明: 接口类型是由一组方法签名定义的集合 …

【java】兴唐第二十四节课
HashMap中put函数的源码分析: (一)知识点: 1、方法resize()的作用是扩容 2、 if ((p tab[i (n - 1) & hash]) null)其中n-1代表最后一个元素的下标,经过和hash的&后获取当前存储nod…

找不到可安装的ISAM”的问题
问题描述: 在 Access 或Sql Server中收到“Could not find installable ISAM”(找不到可安装的 ISAM)错误信息或者丢失某些文件类 解决方法: 1.注册表编辑器使用不当可能导致严重问题,可能需要重新安装操作系统。Micro…

修改mysql的时间/时区
# 背景 往db中insert数据发现时间不对,因为是新DB,所以猜测是mysql设置不对 # 解决方法 方法一:通过mysql命令行模式下动态修改 show variables like "%time_zone%"; 查看时区 --------------------------| Variable_name | Value…

【java】兴唐第二十五节课(异常和log4j的使用)
异常 1、try catch finally语法(附带多重catch) 代码实现: public static void main(String[] args) {try {int i 1/0;}catch(ArithmeticException e){System.out.println("出现数学运算异常:" e);}catch(ArrayIndex…

CentOS 命令提示符颜色及样式详解
命令提示符:prompt CentOS下查看当前命令提示符格式: 1 [rootlocalhost ~]# echo $PS1 #显示当前使用的PS1样式 2 [\u\h \W]\$ 命令提示符参数如下: \d :#代表日期,格式为weekday month date,例如&#…

Max_user_connections 与Max_connections 与max_connect_errors
对于连接数的设置,show variables里有三个参数可以对它进行控制,max_connections与max_user_connections以及max_connect_errors。下面对这三个参数相关描述。 max_connections:针对所有的账号所有的客户端并行连接到MYSQL服务的最大并行连接…

压力变动力,存储追求高效率
企业的数据存储量每年都要大幅增长,但是IT预算呈现紧缩趋势。这就是企业面临的最大存储难题,即如何平衡数据增长与提高存储利用率和降低成本之间的关系。 非结构化数据带来的难题 存储最直接的压力来自于不断增长的数据量。今天,我们面对的是…

Hadoop学习之路(三)Hadoop-2.7.5在CentOS-6.7上的编译
下载Hadoop源码 1、登录官网 2、确定你要安装的软件的版本 一个选取原则: 不新不旧的稳定版本 几个标准: 1)一般来说,刚刚发布的大版本都是有很多问题 2)应该选择某个大版本中的最后一个小版本 阅读编译文档 1、准备一…

static String valueOf(XXX xxx)
1 package day01;2 /**3 * static String valueOf(XXX xxx)4 * 字符串提供了一组静态的重载的valueOf方法,作用5 * 是将其他类型转换为字符串6 * author ta7 *8 */9 public class Demo10 { 10 public static void main(String[] args) { 11 int a 123; 12 …