在Spring MVC Controller中获取查询字符串值 [英] Get Query String Values in Spring MVC Controller

查看:413
本文介绍了在Spring MVC Controller中获取查询字符串值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的引荐来源网址:

I have a referrer URL like this:

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

如何在Spring Controller中获取"page"和"gotoUrl"的值?

How do I get the Values of "page" and "gotoUrl" in my Spring Controller?

我想将这些值存储为变量,以便以后再使用.

I want to store these values as variables, so I can reuse them later.

推荐答案

您可以使用例如;

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

这篇关于在Spring MVC Controller中获取查询字符串值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆