实用的网站,wordpress支付宝个人,怀化市优化办,电脑怎样做幻灯片的网站1、多级路径 ✅类路径和方法路径都可以写成多级 ✅其中#xff0c;类路径写在方法路径前面 ✅与Servlet不同#xff0c;SpringMVC中写不写“/”都可以 RequestMapping(/hello/t1)
RestController
public class HelloSpring {RequestMapping( value world…1、多级路径 ✅类路径和方法路径都可以写成多级 ✅其中类路径写在方法路径前面 ✅与Servlet不同SpringMVC中写不写“/”都可以 RequestMapping(/hello/t1)
RestController
public class HelloSpring {RequestMapping( value world/t2)public String Spring(){return 谢慈悲剃度在莲台下。\n没缘法转眼分离乍。\n赤条条来去无牵挂。;}
} 2、方法的限制
RequestMapping这个前缀对post和get方法都有效 注解里,双引号的值会赋给value这个属性 多个对多个属性赋值,需要写上属性名只有一个属性时,且属性名为value,可以省略 我们在参数中规定一下来限制方法
RequestMapping(/hello/t1)
RestController
public class HelloSpring {RequestMapping( value world/t2,method RequestMethod.GET)public String Spring(){return 谢慈悲剃度在莲台下。\n没缘法转眼分离乍。\n赤条条来去无牵挂。;}
} 再次使用post报错指定方法成功