SpringMVC种通过追踪源码查看是哪种类型的视图渲染器(一般流程方法)

简介: 这篇文章通过示例代码展示了如何在Spring MVC中编写和注册拦截器,以及如何在拦截器的不同阶段添加业务逻辑。

文章目录

    • 代码位置
  • 1、网页效果
  • 2、项目结构
  • 3、部分css样式
  • 4、部分页面代码
  • 5、整体情况
  • 6、如何运行
  • 7、后语

代码位置

源代码位置http://t.csdn.cn/nC8U4

1、网页效果

#轮播图实现动态切换

在这里插入图片描述

2、项目结构

在这里插入图片描述

3、部分css样式

/*去除默认样式*/
::-webkit-scrollbar {
    width: 0;
    height: 1px
}

::-webkit-scrollbar-thumb {
    border-radius: 5px;
    -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, .2);
    background: rgba(0, 0, 0, .2)
}

* {
    outline: none;
    box-sizing: border-box;
}

/* 内外边距通常让各个浏览器样式的表现位置不同 */
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td,hr,button,article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section {
    margin:0;
    padding:0;
}

ul {
    list-style: none;
}

a {
    color: black;
    text-decoration: none;
}

a:hover {
    text-decoration: none;
    color: black;
}

/*正常的未被访问过的链接*/
a:link {
    text-decoration: none;

}
/*已经访问过的链接*/
a:visited {
    text-decoration: none;
    color: black;
}
/*鼠标划过(停留)的链接*/
a:hover {
    text-decoration: none;
}
/* 正在点击的链接,鼠标在元素上按下还没有松开*/
a:active {
    text-decoration: none;
}
/* 获得焦点的时候 鼠标松开时显示的颜色*/
a:focus {
    text-decoration: none;
}

/* 轮播图 */
.swiper-container {
    width: 100%;
    height: 350px;
}

.carousel-img {
    width: 100%;
    height: 100%;
}

.bg-gray {
    background-color: #EEEEEE;
}

.p-10 {
    padding: 10px 0;
}
AI 代码解读

4、部分页面代码

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="pragma" content="no-cache" />
    <meta http-equiv="content-type" content="no-cache, must-revalidate" />
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT" />
    <title>首页</title>
    <link href="css/swiper-5.4.5/swiper.min.css" rel="stylesheet">
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/my.css" rel="stylesheet">
    <link href="css/nav.css" rel="stylesheet">
    <link rel="stylesheet" href="css/nav.css">

</head>

<body style="background-color: #f2dede">

    <div id="wrapper">
        <!--weather
    <div style="text-align: right;">
        <iframe width="700" scrolling="no" height="60" frameborder="0" allowtransparency="true" src="http://i.tianqi.com/index.php?c=code&amp;id=12&amp;icon=1&amp;num=5"></iframe>
    </div>
    weather-->
        <!-- 头部开始 -->
        <div style="width: 100%; height: 30px; line-height: 30px; background-color: #518657">
            <div class="container">
                <div class="col-md-6" style="text-align: left">
                    <a href="" target="_blank" style="color: white; margin-right: 20px">登录</a>
                    <a href="" target="_blank" style="color: white">注册</a>
                </div>
                <div class="col-md-6" style="color: yellow; text-align: right">
                    <span v-if="user.name">
                        欢迎您,{
  
  {user.name}}
                        <a style="color: white" href="javascript:void(0)" >退出</a>
                        <a v-if="isCollect" style="margin-left: 10px" href="collectInfo.html">收藏夹</a>
                    </span>
                </div>
            </div>
            <hr>
        </div>
AI 代码解读

5、整体情况

在这里插入图片描述

6、如何运行

在这里插入图片描述

7、后语

如有需要、可进行商务探讨

相关文章
步步深入SpringMvc DispatcherServlet源码掌握springmvc全流程原理
通过对 `DispatcherServlet`源码的深入剖析,我们了解了SpringMVC请求处理的全流程。`DispatcherServlet`作为前端控制器,负责请求的接收和分发,处理器映射和适配负责将请求分派到具体的处理器方法,视图解析器负责生成和渲染视图。理解这些核心组件及其交互原理,有助于开发者更好地使用和扩展SpringMVC框架。
70 4
Spring MVC源码分析之DispatcherServlet#getHandlerAdapter方法
`DispatcherServlet`的 `getHandlerAdapter`方法是Spring MVC处理请求的核心部分之一。它通过遍历预定义的 `HandlerAdapter`列表,找到适用于当前处理器的适配器,并调用适配器执行具体的处理逻辑。理解这个方法有助于深入了解Spring MVC的工作机制和扩展点。
58 1
Spring MVC源码分析之DispatcherServlet#getHandlerAdapter方法
`DispatcherServlet`的 `getHandlerAdapter`方法是Spring MVC处理请求的核心部分之一。它通过遍历预定义的 `HandlerAdapter`列表,找到适用于当前处理器的适配器,并调用适配器执行具体的处理逻辑。理解这个方法有助于深入了解Spring MVC的工作机制和扩展点。
54 1
Spring MVC源码分析之DispatcherServlet#getHandlerAdapter方法
`DispatcherServlet`的 `getHandlerAdapter`方法是Spring MVC处理请求的核心部分之一。它通过遍历预定义的 `HandlerAdapter`列表,找到适用于当前处理器的适配器,并调用适配器执行具体的处理逻辑。理解这个方法有助于深入了解Spring MVC的工作机制和扩展点。
51 0
SpringMVC入门到实战------六、SpringMVC的视图。ThymeleafView、转发视图、重定向视图、视图控制器的使用详解
这篇文章详细介绍了SpringMVC中的视图类型,包括ThymeleafView、转发视图、重定向视图和视图控制器的使用,以及如何通过源码查看确定使用的视图渲染器类型。
SpringMVC入门到实战------六、SpringMVC的视图。ThymeleafView、转发视图、重定向视图、视图控制器的使用详解
基于ssm框架旅游网旅游社交平台前后台管理系统(spring+springmvc+mybatis+maven+tomcat+html)
基于ssm框架旅游网旅游社交平台前后台管理系统(spring+springmvc+mybatis+maven+tomcat+html)
120 0
【Spring MVC】快速学习使用Spring MVC的注解及三层架构
【Spring MVC】快速学习使用Spring MVC的注解及三层架构
158 1
AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等