Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>How about using "getQuery()" to retrieve the Query String.</p> <pre><code>String query = url.getQuery(); </code></pre> <p>This will give you the the query part of this URL.</p> <p>Use StringTokenizer to separate the parameters. (You will have to apply StringTokenizer twice.)</p> <p>First get tokens from query string which are separated by "&amp;". This will return "val1=5" , "val4=1500", etc.</p> <p>To the above tokens apply StrinTokenizer once again. This time retrieve tokens separated by the "=". Now iterate through this, the first token will be the parameter name "val4", the second token will be the value "1500".</p> <pre><code>StringTokenizer st = new StringTokenizer(query,"&amp;",false); //query is from getQuery() while (st.hasMoreElements()) { // First Pass to retrive the "parametername=value" combo String paramValueToken = st.nextElement().toString(); StringTokenizer stParamVal = new StringTokenizer(paramValueToken, "=", false ); int i = 0; while (stParamVal.hasMoreElements()) { //Second pass to separate the "paramname" and "value". // 1st token is param name // 2nd token is param value String separatedToken = stParamVal.nextElement().toString(); if( i== 0) { //This indicates that it is the param name : ex val4,val5 etc String paramName = separatedToken; } else { // This will hold value of the parameter String paramValue = separatedToken; } i++; } } </code></pre> <p><a href="http://download.oracle.com/javase/1.4.2/docs/api/java/net/URL.html#getQuery%28%29" rel="nofollow">URL getQuery() API Documentation</a></p> <p><a href="http://download.oracle.com/javase/1.4.2/docs/api/java/util/StringTokenizer.html" rel="nofollow">http://download.oracle.com/javase/1.4.2/docs/api/java/util/StringTokenizer.html</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload