SpringMVC注解有哪些具体用途?
- 内容介绍
- 文章标签
- 相关推荐
本文共计486个文字,预计阅读时间需要2分钟。
java@Controllerpublic class HelloWorld { private String s;}
import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @Controller public class HelloWorld { private static String success="success"; @RequestMapping("/helloworld") public String hello() { System.out.println("Hello World"); return success; } } web.xml配置文件
contextConfigLocation
classpath:springmvc.xml
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="ISO-8859-1"%>
testParamAndHeader
testAntPath
testPathVariable Test Get 返回的成功页面success.jsp
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="ISO-8859-1"%>
Success
ModelAndView: ${requestScope.studentMsg } Map: ${requestScope.users } Map: ${requestScope.xixi } SessionAttributes: ${sessionScope.user } SessionAttributes: ${sessionScope.msg }本文共计486个文字,预计阅读时间需要2分钟。
java@Controllerpublic class HelloWorld { private String s;}
import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @Controller public class HelloWorld { private static String success="success"; @RequestMapping("/helloworld") public String hello() { System.out.println("Hello World"); return success; } } web.xml配置文件
contextConfigLocation
classpath:springmvc.xml
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="ISO-8859-1"%>
testParamAndHeader
testAntPath
testPathVariable Test Get 返回的成功页面success.jsp
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="ISO-8859-1"%>

