Get Query String Values in Spring MVC Controller

前端 未结 3 1547
Happy的楠姐
Happy的楠姐 2020-12-30 22:56

I have a referrer URL like this:

http://myUrl.com?page=thisPage&gotoUrl=https://yahoo.com?gotoPage

How do I get the Values of \"page\" and \"gotoUrl\" in

3条回答
  •  南笙
    南笙 (楼主)
    2020-12-30 23:11

    You can use the getParameter() method from the HttpServletRequest interface.

    For example;

      public void getMeThoseParams(HttpServletRequest request){
        String page = request.getParameter("page");
        String goToURL = request.getParameter("gotoUrl");
    }
    

提交回复
热议问题