What is the equivalent to parse_str in java [duplicate]

时间:2022-06-04 11:11:50

Possible Duplicate:
Parsing query strings in Java

可能重复:在Java中解析查询字符串

PHP has parse_str(), is there an equivalent function that does the same thing in java?

PHP有parse_str(),是否有一个等效的函数在java中做同样的事情?

2 个解决方案

#1


3  

PHPs parse_str has two modes of operation:

PHPs parse_str有两种操作模式:

  1. If given a single argument, parse_str will set parameters as variables in the current scope. For this mode of operation, there is no equivalent in Java.
  2. 如果给定单个参数,则parse_str将参数设置为当前范围中的变量。对于这种操作模式,Java中没有等效的。

  3. If given two arguments, the second argument must be an array which will be populated with the query string parameters/values. For an equivalent in Java, see this answer on parsing query strings in Java.
  4. 如果给出两个参数,则第二个参数必须是一个将使用查询字符串参数/值填充的数组。对于Java中的等价物,请参阅以Java解析查询字符串的答案。

#2


0  

You can use the ServletRequest object's getParameter method. http://download.oracle.com/javaee/6/api/javax/servlet/ServletRequest.html)

您可以使用ServletRequest对象的getParameter方法。 http://download.oracle.com/javaee/6/api/javax/servlet/ServletRequest.html)

#1


3  

PHPs parse_str has two modes of operation:

PHPs parse_str有两种操作模式:

  1. If given a single argument, parse_str will set parameters as variables in the current scope. For this mode of operation, there is no equivalent in Java.
  2. 如果给定单个参数,则parse_str将参数设置为当前范围中的变量。对于这种操作模式,Java中没有等效的。

  3. If given two arguments, the second argument must be an array which will be populated with the query string parameters/values. For an equivalent in Java, see this answer on parsing query strings in Java.
  4. 如果给出两个参数,则第二个参数必须是一个将使用查询字符串参数/值填充的数组。对于Java中的等价物,请参阅以Java解析查询字符串的答案。

#2


0  

You can use the ServletRequest object's getParameter method. http://download.oracle.com/javaee/6/api/javax/servlet/ServletRequest.html)

您可以使用ServletRequest对象的getParameter方法。 http://download.oracle.com/javaee/6/api/javax/servlet/ServletRequest.html)