<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Lettura Json da file php in jsp.]]></title><description><![CDATA[<p dir="auto">Salve a tutti,<br />
illustro il mio problema sperando possiate aiutarmi.<br />
Ho un file PHP che genera un JSON e uno JSP che lo dovrebbe leggere.<br />
Questo mi serve perchè devo sincronizzare 2 db su due server differenti.<br />
Come faccio a leggere ciò che mi restituisce il file.php nel file.jsp??<br />
<img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/android/274c.png?v=12b9555a9a1" class="not-responsive emoji emoji-android emoji--x" style="height:1.4em;width:auto;vertical-align:middle" title=":x:" alt="❌" />x</p>
]]></description><link>https://dev.connect.gt/topic/117263/lettura-json-da-file-php-in-jsp</link><generator>RSS for Node</generator><lastBuildDate>Wed, 25 Nov 2026 21:50:18 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/117263.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 14 Dec 2009 15:21:01 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Lettura Json da file php in jsp. on Mon, 14 Dec 2009 22:34:35 GMT]]></title><description><![CDATA[<p dir="auto">Ciao spizzico7,</p>
<p dir="auto">è vero: certamente puoi fare come tu indichi.<br />
Le librerie che ti avevo suggerito ti risparmiano il parsing degli oggetti successivo.</p>
]]></description><link>https://dev.connect.gt/post/878819</link><guid isPermaLink="true">https://dev.connect.gt/post/878819</guid><dc:creator><![CDATA[mister.jinx]]></dc:creator><pubDate>Mon, 14 Dec 2009 22:34:35 GMT</pubDate></item><item><title><![CDATA[Reply to Lettura Json da file php in jsp. on Mon, 14 Dec 2009 20:33:11 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto"><strong>mister.jinx</strong></p>
<p dir="auto">Ciao spizzico7,</p>
<p dir="auto">ti potrebbero aiutare queste librerie (ma ce ne sono molte altre analoghe):<br />
<a href="http://json.org/java/" rel="nofollow ugc">json.org/java/</a><br />
<a href="http://json-lib.sourceforge.net" rel="nofollow ugc">json-lib.sourceforge.net</a></p>
</blockquote>
<p dir="auto">Grazie dell'aiuto ma ho trovato un modo migliore...ovvero:<br />
avendo già un json generato molto semplicemente in php mi basta leggere il codice in jsp con il seguente codice.</p>
<pre><code>public class JavaGetUrl {

   public static void main (String[] args) {

      //-----------------------------------------------------//
      //  Step 1:  Start creating a few objects we'll need.
      //-----------------------------------------------------//

      URL u;
      InputStream is = null;
      DataInputStream dis;
      String s;

      try {

         //------------------------------------------------------------//
         // Step 2:  Create the URL.                                   //
         //------------------------------------------------------------//
         // Note: Put your real URL here, or better yet, read it as a  //
         // command-line arg, or read it from a file.                  //
         //------------------------------------------------------------//

         u = new URL("h t t p : / / 2 0 0 . 2 1 0 . 2 2 0 . 1 : 80 8 0 / i n d e x  . ht m  l ");

         //----------------------------------------------//
         // Step 3:  Open an input stream from the url.  //
         //----------------------------------------------//

         is = u.openStream();         // throws an IOException

         //-------------------------------------------------------------//
         // Step 4:                                                     //
         //-------------------------------------------------------------//
         // Convert the InputStream to a buffered DataInputStream.      //
         // Buffering the stream makes the reading faster; the          //
         // readLine() method of the DataInputStream makes the reading  //
         // easier.                                                     //
         //-------------------------------------------------------------//

         dis = new DataInputStream(new BufferedInputStream(is));

         //------------------------------------------------------------//
         // Step 5:                                                    //
         //------------------------------------------------------------//
         // Now just read each record of the input stream, and print   //
         // it out.  Note that it's assumed that this problem is run   //
         // from a command-line, not from an application or applet.    //
         //------------------------------------------------------------//

         while ((s = dis.readLine()) != null) {
            System.out.println(s);
         }

      } catch (MalformedURLException mue) {

         System.out.println("Ouch - a MalformedURLException happened.");
         mue.printStackTrace();
         System.exit(1);

      } catch (IOException ioe) {

         System.out.println("Oops- an IOException happened.");
         ioe.printStackTrace();
         System.exit(1);

      } finally {

         //---------------------------------//
         // Step 6:  Close the InputStream  //
         //---------------------------------//

         try {
            is.close();
         } catch (IOException ioe) {
            // just going to ignore this one
         }

      } // end of 'finally' clause

   }  // end of main

} // end of class definition
</code></pre>
]]></description><link>https://dev.connect.gt/post/878820</link><guid isPermaLink="true">https://dev.connect.gt/post/878820</guid><dc:creator><![CDATA[spizzico7]]></dc:creator><pubDate>Mon, 14 Dec 2009 20:33:11 GMT</pubDate></item><item><title><![CDATA[Reply to Lettura Json da file php in jsp. on Mon, 14 Dec 2009 19:16:51 GMT]]></title><description><![CDATA[<p dir="auto">Ciao spizzico7,</p>
<p dir="auto">ti potrebbero aiutare queste librerie (ma ce ne sono molte altre analoghe):<br />
<a href="http://json.org/java/" rel="nofollow ugc">json.org/java/</a><br />
<a href="http://json-lib.sourceforge.net" rel="nofollow ugc">json-lib.sourceforge.net</a></p>
]]></description><link>https://dev.connect.gt/post/878816</link><guid isPermaLink="true">https://dev.connect.gt/post/878816</guid><dc:creator><![CDATA[mister.jinx]]></dc:creator><pubDate>Mon, 14 Dec 2009 19:16:51 GMT</pubDate></item></channel></rss>