如下代码,重定向失败,怎么才能重定向成功
@RestController
@RequestMapping("/eduorder/paylog")
//@CrossOrigin
public class PayLogController {
@GetMapping("/getreturn")
public String getreturn(HttpServletRequest request, HttpServletResponse response) throws AlipayApiException, IOException {
return "redirect:http://www.nslcj.com";
}
}
这个注解 @RestController
换成 @Controller
请点采纳
String url = "redirect:http://www.nslcj.com";
httpResponse.sendRedirect(url);
把@RestController注解换成@Controller