5 Replies Latest reply: Nov 26, 2012 4:55 AM by Tolls RSS

    HttpURLConnection and HtmlUnit


      I am using these commands to get a webpage from my in-house webserver:

      String urlStr = "http://localhost/welcome.jsp";
      URL url = new URL(urlStr);
      HttpURLConnection ucon = (HttpURLConnection)url.openConnection();
      InputStreamReader isr = new InputStreamReader(ucon.getInputStream());
      BufferedReader in = new BufferedReader(isr);

      I then read the file line by line, searching the text for this input tag:

      <input type=hidden name=pagecode value=123>

      Is there any easier way to get the value of this hidden variable?

      Does the HttpURLConnection have some way of extracting hidden values directly?

      Thank you for helping.