I have a website on which I added a dropdown menu and a button. When the dropdown menu changes it calls a Requestmapping "/Filter".
The following code is underlying the Requestmapping "/Filter"
@Controller
public class FilterController
{
@RequestMapping(value = "/Filter")
public String selectmenu(@RequestParam String selectmenu, HttpServletRequest request)
{
System.out.println(selectmenu);
String URL = makeUrl(request);
System.out.println(URL);
return “ABC";
};
public static String makeUrl(HttpServletRequest request)
{
return request.getRequestURL().toString() + "?" + request.getQueryString();
}
}
This returns the following URL: http://localhost:8080/Filter?null
I understand why this URL is returned. But the URL in the address bar is different, namely: http://localhost:8080/Name?id=1
I want to retrieve the URL in the address bar, how can this be accomplished?