如何在Spring MVC中请求完整的查询字符串? [英] How to request complete query string in Spring MVC?

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

问题描述

在Spring MVC中,我可以这样做以获取查询字符串上的项的值:

In Spring MVC, I can do this to get a value of items on the query string:

    public void sendMessage(HttpServletResponse response,
                           @RequestParam("Session Id") String sessionId,

但如何我得到完整的查询字符串作为一个长字符串?即我不想要它的个别参数,我想要整个事情?

But how to I get the complete querystring as one long string? I.e. I don't want individual parameters from it, I want the whole thing?

非常感谢!

推荐答案

HttpServletRequest 添加为方法的参数,并从请求中获取查询字符串:

Add the HttpServletRequest as argument to the method, and get the query string from the request:

public void sendMessage(HttpServletRequest request,
                        HttpServletResponse response {
    String queryString = request.getQueryString();
}

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

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