简体   繁体   English

如何从URL获取请求查询字符串

[英]How to get request query string from the URL

I am trying to extract the query string from the static URL from the browser using Java. 我正在尝试使用Java从浏览器的静态URL中提取查询字符串。 But when I use the getQueryString() method, it is returning the query string for the particular portlet. 但是,当我使用getQueryString()方法时,它将返回特定portlet的查询字符串。

For example: my static url looks like this /owner/?search&name= and the portlet URL is /home/create which can't be seen in the browser URL. 例如:我的静态URL看起来像/ owner /?search&name = ,而portlet URL是/ home / create ,在浏览器URL中看不到。

Is there any way to extract the query string from Static URL? 有什么方法可以从静态网址提取查询字符串?

James, 詹姆士,

You may try to use PortletRequest.getParameterMap() , returning a java.util.Map of java.lang.String,java.lang.String[] - as in the official JSR-286 spec 您可以尝试使用PortletRequest.getParameterMap() ,返回java.lang.String,java.lang.String []的java.util.Map-与官方JSR-286规范中一样

Check the link, there are some other methods to extract URL parameters and values. 检查链接,还有其他一些方法可以提取URL参数和值。

Hope this helps, Philippe 希望这会有所帮助,Philippe

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM