Giter VIP home page Giter VIP logo

learngit's Introduction

requsetMapping可以修饰方法也可以修饰类
类定义了映射的初步信息,方法定义了具体信息【RUL】
requwstMapping(value,method,params,heads)
value == URL
method == POST/GET/PUT..
parmas和headers支持简单的表达式
	@RequestMapping(value="/ph",params={"username","age!=10"})
	public String testParamsAndHeader(){
		System.out.println("success");
		return "success";
	}
request映射表达式:(Ant风格的路径)
*:匹配任意多个字符

@pathvariable映射RUL绑定的占位符
@RequestMapping("/test/{id}")
	public String testPathVariable(@PathVariable("id") Integer id){
		System.out.println("test Variagle"+id);
		return "success";
	}

http://localhost:8080/SpringMVC1/test/33.do

REST:资源表现层状态转化,最流行的互联网软件构架
Resources:
@RequestMapping(value = "/testRequestParam")
	public String testRequestParam(
			@RequestParam(value = "username") String un,
			@RequestParam(value = "age", required = false, defaultValue = "0") int age) {
		System.out.println("testRequestParam, username: " + un + ", age: "
				+ age);
		return "success";
	}
获取请求参数,映射请求参数!!!!

@CookieValue

使用POJO对象绑定请求参数

//此处有问题!!!
可以将Map和model和ModelMap类型数据作为目标方法的参数
	BindingAwareModelMap

Spring 支持REST风格的请求
REST风格的请求是通过将post请求做进一步封装而成,通过在表单中添加一个隐藏域,并给这些隐藏域一个特定的值,就能够将post请求转化成rest风格的请求【get put delete post】


@SessionAtributes可以放在类上边可以将数据放入其中,供多个类使用
@ModelAttribute 标记的方法会在被每个目标方法执行前被springMVC调用

fmt JSTL的国际化标签,需要在spring-mvc的配置文件中配置国际化资源文件

可以配置直接转发的页面,不需要handler的处理。
<mvc:view-Controller path="" view-name=""/>
注:在实际开发中通常都需要配置mvc:annotation-driven标签,否则


重定向:字符串中带有forward和redirectSpringMVC会对字符串特殊处理

learngit's People

Contributors

lixuyn avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.