Spring控制器接受重复请求
每当我向服务器发送请求时,它都会在url中获取重复的条目 有关详细说明,请参见下面的示例Spring控制器接受重复请求,spring,spring-boot,jsp,Spring,Spring Boot,Jsp,每当我向服务器发送请求时,它都会在url中获取重复的条目 有关详细说明,请参见下面的示例 @Controller @RequestMapping("v") public class ControllerDemo{ @RequestMapping("test") public String view() { return "index.jsp"; } @RequestMapping("view") public String view() { return "l
@Controller
@RequestMapping("v")
public class ControllerDemo{
@RequestMapping("test")
public String view()
{
return "index.jsp";
}
@RequestMapping("view")
public String view()
{
return "login.jsp";
}
}
第一次请求Url:Https:localhost:8080/v/test 当我从test.jsp获取不同的请求时,它执行以下模式Https:localhost:8080/v/v/view
在Test.jsp中
<form action="v/view">
//Some data and submit
</form>
//一些数据并提交
它将以url:https:localhost:8080/v/v/view而不是localhost:8080/v/view发送请求
如果您需要任何其他信息或项目配置,请告诉我。仅从问题本身来看,
操作
标记的值似乎被附加到当前页面的路径,因此https:localhost:8080/v+v/view
=https:localhost:8080/v/v/view
解决方案:仅更改为
这一点得到了以下事实的支持:
action=”“
谢谢,我被搞砸了。如果我们想处理不同的请求,这样它就不会附加现有的链接,创建一个新的请求,比如从localhost:8080/v/view到localhost:8080/user/my_account。有时候小错误会把你搞砸,哈哈