springmvc怎么修改访问路径
@ControllerpublicclassUserContrller{@AutowiredprivateUserServiceuserService;。。。。这是在co...
@Controller
public class UserContrller {
@Autowired
private UserService userService;
。。。。
这是在controller
在访问时 路径为springMVC/usercontrller/login.html
请问怎么能变成springMVC/XXXX/login.html
十分感谢!! 展开
public class UserContrller {
@Autowired
private UserService userService;
。。。。
这是在controller
在访问时 路径为springMVC/usercontrller/login.html
请问怎么能变成springMVC/XXXX/login.html
十分感谢!! 展开
2个回答
展开全部
设置下controller中的@RequestMapping属性值即可,之后运行完此方法后会进行重定向。
举例:
@RequestMapping(value = "/address.jsp", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> addressPOST() {
Map<String, Object> map = new HashMap<>();
ReceivedGoodsAddress receivedgoodsaddress=new ReceivedGoodsAddress();
List<ReceivedGoodsAddress> list = addressService.findReceivedGoodsAddress(receivedgoodsaddress);
map.clear();
map.put("list", list);
return map;
}
举例:
@RequestMapping(value = "/address.jsp", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> addressPOST() {
Map<String, Object> map = new HashMap<>();
ReceivedGoodsAddress receivedgoodsaddress=new ReceivedGoodsAddress();
List<ReceivedGoodsAddress> list = addressService.findReceivedGoodsAddress(receivedgoodsaddress);
map.clear();
map.put("list", list);
return map;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询