0

Whenever I send request to the server it takes duplicate entry in url.

For detailed description please see below example.

 @Controller
 @RequestMapping("v")
 public class ControllerDemo{

  @RequestMapping("test")
  public String view()
 {
    return "index.jsp";
 }

@RequestMapping("view")
public String view()
{
   return "login.jsp";
}
   }

First request to Url: Https:localhost:8080/v/test When I go for a different request from test.jsp then it executes the following pattern Https:localhost:8080/v/v/view


In Test.jsp

    <form action="v/view">
       //Some data and submit
    </form>

It will send the request in url: https:localhost:8080/v/v/view instead of localhost:8080/v/view

Please let me know if you need to any other info or project configuration.

Amit Mishra
  • 498
  • 5
  • 16

1 Answers1

1

Just from the question itself it appears that the action tag's value is being appended to the path of the current page, so https:localhost:8080/v + v/view = https:localhost:8080/v/v/view.

Solution: change to just <form action="view">

This is backed up by the fact that action="" points to the current page.

JHall
  • 93
  • 1
  • 7
  • Thank you, I was messed up with this. What if we want to go for different request so that it don't append the existing link, creating a new request like from localhost:8080/v/view to localhost:8080/user/my_account. Sometimes minor mistakes can mess you up LOL – Amit Mishra Nov 19 '19 at 13:32