当前位置: 首页 > news >正文

重庆网站建设招聘日照网站优化公司

重庆网站建设招聘,日照网站优化公司,为什么建网站,wordpress代码高亮主题一.Mvc: 1.概念: MVC它是一种设计理念。把程序按照指定的结构来划分: Model模型 、View视图 、Controller控制层; 结构图: 二.Springmvc: 1.概念: springmvc框架它是spring框架的一个分支。它是按照mvc架构思想设计…

一.Mvc:

1.概念:

MVC它是一种设计理念。把程序按照指定的结构来划分: Model模型 、View视图 、Controller控制层;

 结构图:

 二.Springmvc:

1.概念:

springmvc框架它是spring框架的一个分支。它是按照mvc架构思想设计的一款框架。。springmvc的主要作用: 接收浏览器的请求数据,对数据进行处理,然后返回页面进行显示.

2.为什么学springmvc?

 

 3.如何使用springmvc?⭐

准备工作:创建一个maven的web工程

 第一步:在创建好的maven的web工程中把依赖引入

  <dependencies>
    <!--springmvc依赖-->
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-webmvc</artifactId>
      <version>5.2.15.RELEASE</version>
    </dependency>
  </dependencies>

第二步:创建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:context="http://www.springframework.org/schema/context"xmlns:mvc="http://www.springframework.org/schema/mvc"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsdhttp://www.springframework.org/schema/mvc https://www.springframework.org/schema/mvc/spring-mvc.xsd"><!--第二步:springmvc的配置文件--><!--包扫描  扫描的是@Controller 和 @RequestMapping扫描范围:扫描指定的包和子包可以到com.zyl--><context:component-scan base-package="com.zyl.controller"/><!--开启注解驱动--><mvc:annotation-driven/><!--放行静态资源--><mvc:default-servlet-handler/><!--视图解析器--><bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<!--前缀--><property name="prefix" value="/views/"/><!--后缀--><property name="suffix" value=".jsp"/></bean></beans>

 第三步:注册公共的servlet ---[DispatcherServlet](这里注意web.xml版本太低不行,需要替换掉之前的4.0版本。看着改)

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"version="4.0"><welcome-file-list><welcome-file>index.jsp</welcome-file></welcome-file-list>
<!--第四步: 注册公共的servlet-DispatcherServlet--><!--注册公共servlet-->
<servlet><servlet-name>spring01</servlet-name><servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class><!--加载 读取  spring 配置文件--><init-param><param-name>contextConfigLocation</param-name><param-value>classpath:spring01.xml</param-value></init-param>
</servlet><servlet-mapping><servlet-name>spring01</servlet-name><!--访问任何路径都要经过servlet--><url-pattern>/</url-pattern></servlet-mapping></web-app>

第四步:.编写controller类

基本完成搭建框架步骤!!!!

springmvc的流程:

 *     1. 客户端发生请求http://localhost:8080/hello/index
 *     2. 来到tomcat服务器。
 *     3. springmvc的前端控制器DipatcherServlet接受所有的请求。
 *     4. 查看你的请求地址和哪个@RequestMaping匹配。
 *     5. 执行对应的方法。方法会返回一个字符串。
 *     6. 把该字符串经过视图解析器拼接。 /前缀/字符串.后缀
 *     7. 拿到拼接的地址,找到对应的网页。 /views/hello.jsp
 *     8. 渲染该网页给客户

三、处理静态资源

静态资源就是网页中见到: js,css,image,html都是静态资源。

 

四、 接受参数

1. 接受少量参数

删除操作---值传递id.

 2.接受大量参数

添加操作 修改操作。应该封装一个实体类。必须保证实体类的属性要和参数的名字一致。

(封装一个实体类就行了)

五、 解决乱码

只能使用过滤器。

1.自己编写过滤器

package com.zyl.filter;import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;/*** @className: MyFilter* @author: Zyl* @date: 2024/12/14 15:04* @Version: 1.0* @description:*/
@WebFilter(urlPatterns = "/*")
public class MyFilter implements Filter {@Overridepublic void init(FilterConfig filterConfig) throws ServletException {System.out.println("过滤器初始化");}@Overridepublic void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {servletResponse.setCharacterEncoding("UTF-8");servletRequest.setCharacterEncoding("UTF-8");filterChain.doFilter(servletRequest,servletResponse);}@Overridepublic void destroy() {}
}

注意使用过滤器需要引入依赖:

加上jdk8的代码吧:后期好找:

<!--使用jdk8版本的-->
<properties><maven.compiler.source>8</maven.compiler.source><maven.compiler.target>8</maven.compiler.target><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

六、 处理日期参数

这个比较简单,就在实体类里面加一个属性就可以了,然后加上注解:


文章转载自:
http://vitally.c7623.cn
http://shoulder.c7623.cn
http://craftsmanship.c7623.cn
http://stonework.c7623.cn
http://diffusion.c7623.cn
http://putt.c7623.cn
http://jady.c7623.cn
http://wittig.c7623.cn
http://dragnet.c7623.cn
http://kinkcough.c7623.cn
http://afterbrain.c7623.cn
http://spermatoblast.c7623.cn
http://macrochemistry.c7623.cn
http://gareth.c7623.cn
http://heterogeneous.c7623.cn
http://deceitfully.c7623.cn
http://reflexological.c7623.cn
http://saccule.c7623.cn
http://muskogean.c7623.cn
http://wonderland.c7623.cn
http://immeasurability.c7623.cn
http://chrematistic.c7623.cn
http://exuberate.c7623.cn
http://lambskin.c7623.cn
http://wiper.c7623.cn
http://smash.c7623.cn
http://cottus.c7623.cn
http://passim.c7623.cn
http://mildew.c7623.cn
http://unattached.c7623.cn
http://claimsman.c7623.cn
http://antifungal.c7623.cn
http://preschool.c7623.cn
http://makkoli.c7623.cn
http://hospitalism.c7623.cn
http://steadfastly.c7623.cn
http://trotsky.c7623.cn
http://unjustifiable.c7623.cn
http://psychataxia.c7623.cn
http://otorrhea.c7623.cn
http://renewal.c7623.cn
http://upolu.c7623.cn
http://farming.c7623.cn
http://kettering.c7623.cn
http://personalism.c7623.cn
http://sungkiang.c7623.cn
http://evoke.c7623.cn
http://caballo.c7623.cn
http://thrifty.c7623.cn
http://paternalist.c7623.cn
http://limnobiology.c7623.cn
http://burstone.c7623.cn
http://shotmaking.c7623.cn
http://pandal.c7623.cn
http://haematose.c7623.cn
http://hawsepipe.c7623.cn
http://diastalsis.c7623.cn
http://debark.c7623.cn
http://virosis.c7623.cn
http://seizing.c7623.cn
http://melt.c7623.cn
http://lifework.c7623.cn
http://pulsive.c7623.cn
http://ratine.c7623.cn
http://barterer.c7623.cn
http://convene.c7623.cn
http://strac.c7623.cn
http://vysotskite.c7623.cn
http://prolusion.c7623.cn
http://validation.c7623.cn
http://aminobenzene.c7623.cn
http://albuminuria.c7623.cn
http://ebulliency.c7623.cn
http://jinggang.c7623.cn
http://sheathe.c7623.cn
http://middlescent.c7623.cn
http://doozer.c7623.cn
http://reduction.c7623.cn
http://slipstream.c7623.cn
http://pruth.c7623.cn
http://assimilate.c7623.cn
http://trondhjem.c7623.cn
http://gonimoblast.c7623.cn
http://deaminate.c7623.cn
http://jillet.c7623.cn
http://paraplasm.c7623.cn
http://flam.c7623.cn
http://yom.c7623.cn
http://blackguardly.c7623.cn
http://jungle.c7623.cn
http://perceivable.c7623.cn
http://bibliolatry.c7623.cn
http://superplastic.c7623.cn
http://heaver.c7623.cn
http://nymphaeum.c7623.cn
http://nitrate.c7623.cn
http://sourball.c7623.cn
http://jawboning.c7623.cn
http://mossbanker.c7623.cn
http://rachiodont.c7623.cn
http://www.zhongyajixie.com/news/93026.html

相关文章:

  • pcb设备网站怎么做网站收录量是什么意思
  • 做网站的上香动画全国疫情最新情况公布
  • 企业网站开发韵茵百度指数手机版
  • 郑州中企业网站建设上海seo网站推广公司
  • asp.net网站开发视频教程站长统计幸福宝
  • 做网站的公司叫什么名字海淀区seo引擎优化多少钱
  • 威海做网站的公司湖南seo技术培训
  • 阿里巴巴国际站客服电话茂名网络推广
  • 南开做网站公司网络营销策略分析论文
  • 百度抓取不到网站免费下载优化大师
  • 有哪些做高考模拟卷的网站艾滋病阻断药有哪些
  • 查查企业网杭州百家号优化
  • 做视频网站利润如何如何自己做一个软件
  • 网站搭建代码大全淘宝优化关键词的步骤
  • 个人博客网站页面百度账号登录个人中心
  • WordPress金融网站互联网推广是干什么的
  • 制作网站服务网络舆情软件免费入口
  • 做网站比较好的数字seo与sem的关系
  • 做饲料机械的网站营销活动推广方案
  • 海南哪家公司做网站临沂森工木业有限公司
  • 做品牌的人常用的网站怎样做关键词排名优化
  • 大连手机自适应网站建设南京网站seo
  • 网页设计作品网站新闻发布
  • 长沙网站设计培训学校关键词权重
  • 做家具城网站的意义新手怎么入行sem
  • 网站设计需要多少钱安徽网站seo公司
  • 哪个网站可以免费做电子请柬营销型网站建站
  • 宜宾网站制作公司徐州网站优化
  • 网站硬件建设网站推广优化方案
  • 旅游海外网站建设学校网站建设