目录
- mybatis:
- mapper-locations: classpath:mappers/*xml
- type-aliases-package: com.xnx.spboot04.model
- server:
- port: 8080
- servlet:
- context-path: /spboot04
- spring:
- application:
- name: spboot04
- datasource:
- driver-class-name: com.mysql.jdbc.Driver
- name: defaultDataSource
- password: 123456
- url: jdbc:mysql://localhost:3306/t280?useUnicode=true&characterEncoding=UTF-8
- username: root
- freemarker:
- cache: false
- charset: utf-8
- expose-request-attributes: true
- expose-session-attributes: true
- suffix: .ftl
- template-loader-path: classpath:/templates/
- mvc:
- static-path-pattern: /static/**
- # resources:
- # static-locations: classpath:/static/# Ӧ�÷��� WEB ���ʶ˿�
- pagehelper:
- reasonable: true
- supportMethodsArguments: true
- page-size-zero: true
- helper-dialect: mysql
- logging:
- level:
- com.xnx.spboot04: debug
- package com.zhoujuan.spboot04.controller;
-
- import com.zhoujuan.spboot04.entity.User;
- import lombok.AllArgsConstructor;
- import lombok.Data;
- import lombok.NoArgsConstructor;
- import org.springframework.stereotype.Controller;
- import org.springframework.ui.Model;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.servlet.ModelAndView;
-
- import java.util.Arrays;
-
- /**
- * @author zhoujuan
- * @create 2022-11-01 17:45
- */
- @Controller
- public class IndexController {
- // @RequestMapping("/")
- // public ModelAndView index(){
- springmvc
- // ModelAndView mv = new ModelAndView();
- // mv.addObject("uname","aa");
- // mv.setViewName("index");
- // System.out.println("come in");
- // return mv;
- // }
-
- @RequestMapping("/")
- public String index(Model model){
- model.addAttribute("sex","mimi");
- // model.addAttribute("uname","aa");
- model.addAttribute("users", Arrays.asList(new User(1,"zs"),
- new User(2,"ls"),new User(3,"ww")));
- model.addAttribute("arr",new Integer[]{3,4,5,6,7,8,9});
- System.out.println("come in");
- return "index";
- }
- }
-
-
- <#assign ctx>
- ${springMacroRequestContext.contextPath}
- </#assign>
-
- <#global ctx2>
- ${springMacroRequestContext.contextPath}
- </#global>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title></title>
- </head>
- <body>
- <h3>取值</h3>
- <p>1.1提供默认值</p>
- <#--当接收的参数不为空会报错。这个问题是需要避免的-->
- <#--${uname}-->
- <#--{uname !}-->