每当我向服务器发送请求时,它都会在URL中重复输入。
有关详细说明,请参见以下示例。
@Controller
@RequestMapping("v")
public class ControllerDemo{
@RequestMapping("test")
public String view()
{
return "index.jsp";
}
@RequestMapping("view")
public String view()
{
return "login.jsp";
}
}
对网址的第一个请求: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
如果需要其他任何信息或项目配置,请告诉我。
答案 0 :(得分:1)
从问题本身看来,action
标签的值似乎被附加到当前页面的路径上,因此https:localhost:8080/v + v/view
= https:localhost:8080/v/v/view
。
解决方案:仅更改为<form action="view">
action=""
points to the current page.