title: How do I get the key=value pair in the url?
body: <p>I have this code:</p>
  
  <pre><code>while(paramNames.hasMoreElements()) { 
      String paramName = (String)paramNames.nextElement();
      String paramValue = request.getHeader(paramName);
  
      out.println(paramName + "=" + paramValue);
  }
  </code></pre>
  
  <p>that produces:</p>
  
  <pre><code>course_code3=null schedule_no3=null course_sched3=null
  </code></pre>
  
  <p>when the url contains the following:</p>
  
  <pre><code>pntc_confirmrsvd.jsp?course_sched3=3&amp;course_code3=CSM101&amp;schedule_no3=201403
  </code></pre>
  
  <p>Why am I not getting the key=value pair in the url? What wrong with the code above? Any help will be really appreciated as I've been stumped by this for 3 hours already. :(</p>
  
  <p>What I actually need to do is something like this:</p>
  
  <pre><code>while(paramNames.hasMoreElements())
  { 
      String paramName = (String)paramNames.nextElement();
      String paramValue = request.getHeader(paramName);
  
      if (paramName.contains("course_code"))
      {
          course_code = paramValue;
      }
      else if (paramName.contains("schedule_no"))
      {
          schedule_no = paramValue;
      }
      else if (paramName.contains("course_sched"))
      {
          course_sched = paramValue;
      }
  
      out.println("Course: " + course_code + " ,Schedule: " + schedule_no + " , Item: "+course_sched);
  }
  </code></pre>