• StringMVC


    public class FirstController implements Controller {
        public ModelAndView handleRequest(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
            ModelAndView mv=new ModelAndView();
            mv.setViewName("index");
            return mv;
        }
    }
    

      

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:aop="http://www.springframework.org/schema/aop"
           xmlns:context="http://www.springframework.org/schema/context"
           xmlns:tx="http://www.springframework.org/schema/tx"
           xmlns:p="http://www.springframework.org/schema/p"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="
            http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
            http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
            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
    ">
      <!--视图解析器-->
    
      <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/"></property>
        <property name="suffix" value=".jsp"></property>
      </bean>
    

      

    <!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>
      <!--配置前端控制器-->
      <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:springmvc.xml</param-value>
        </init-param>
    
        <load-on-startup>1</load-on-startup>
      </servlet>
    
      <servlet-mapping>
        <servlet-name>springmvc</servlet-name>
        <url-pattern>/</url-pattern>
      </servlet-mapping>
    
    </web-app>
    

      

  • 相关阅读:
    9ch
    thymeleaf 的使用(三)--举例使用
    thymeleaf 的使用(二)--基本语法
    thymeleaf 的使用(一)--导入和基本操作
    SpringBoot对静态资源的映射规则
    第一个Spring Boot项目
    HTML文本换行问题
    判断for(var i=0;i<=3;i++){ setTimeout(function() { console.log(i) }, 10) }
    js的执行机制——宏任务和微任务
    v-if 和 v-show 的区别
  • 原文地址:https://www.cnblogs.com/2652405350wch/p/7398807.html
Copyright © 2020-2023  润新知