Hi, I have written the following code. It works fine. But there is a problem in it: 1) I am on LAN and behind proxy server. When I give local IP address of a site. It is accessing it and shows its contents. But when I give some site's URL e.g www.yahoo.com, it gives error: connection failure. It is not understandable why is it giving this error as it is establishing url conection and I am accessing these site from the same computer.
2) Does anyone has accessed the data via XML. e.g any site opening its data in XML form and will access its Data via XML and manipulate the data in our own look & feel. Waiting for gr8 responses.. Hamid Hassan Software Engineer -----Original Message----- From: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]] On Behalf Of Daniel Jaffa Sent: Monday, October 22, 2001 7:50 PM To: [EMAIL PROTECTED] Subject: Re: SV: How do I access the static HTML generated by a JSP? I think this code would work for you. If you put this code into a bean and store all the lines to the database. You then could make it a session variable and print it out. I got this code from two different sites, and it works great. If you have any problems email me directly. Daniel Jaffa Computer GOD who Created the Stars and Moon "If you are not happy, I am not happy" <% BufferedReader br = null; HttpURLConnection urlc = null; URL u = null; urlString = "http://yoururl.com" String line = ""; try { u = new URL (urlString); } catch (MalformedURLException mfurle) { System.out.println ("URL: " + urlString + "\t\tMalformed URL " + mfurle.getMessage()); } try { urlc = (HttpURLConnection)u.openConnection (); } catch (UnknownHostException uhe) { System.out.println (urlString + "\tUnknown Host " + uhe.getMessage()); } catch (NoRouteToHostException nrthe) { System.out.println (urlString + "\tNo Route to Host " + nrthe.getMessage()); } catch (Exception e) { System.err.println (urlString + "\tException " + e.getMessage()); } // Now we can connect and start loading the page try { urlc.connect (); } catch (IOException ioe) { System.out.println ("Connection Failure " + urlString + "\tException: " + ioe.getMessage()); } catch (Exception e) { System.err.println (urlString + "\tException " + e.getMessage()); } br = new BufferedReader (new InputStreamReader (urlc.getInputStream ())); while ( (line = br.readLine ()) != null ) { %><%=line%><%="\n"%><% } br.close (); urlc.disconnect (); } %> ----Original Message Follows---- Thanks for that, Jan. I don't think it is what I am looking for, although it might be my only solution. I am trying to find a pure JSP way of accessing the HTML. For instance, my JSP might look something like this... <jsp:useBean id="usethisbean" class="package.JavaBean" /> <jsp:setProperty name="usethisbean" property="*" /> <HTML> <HEAD> </HEAD> <BODY> The result of the database query is <jsp:getProperty name="usethisbean" property="value"/> </BODY> </HTML> The HTML source at the browser would look like this: <HTML> <HEAD> </HEAD> <BODY> The result of the database query is MyValue </BODY> </HTML> When I detach it using the JavaScript button function, I don't want to call the JSP again or re-submit the database query. All I want to do is send the actual HTML source to the browser again by retrieving it using servlet APIs or something. I don't even know if this is possible. David _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp ======================================================================== === To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com
