Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Consume XML in JSP from a URL  RSS feed

 
Satya Sri
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Please let me know the best approach in the below scenario :

I have a URL which returns an XML. I want to use this URL in a JSP page get the output XML, store it in a string and apply some CSS over it.

Please let me know the best way to approach this.

Thanks,
Satya.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The best way to approach the problem is to develop a freestanding Java class that opens the URL and reads the stream into an XML parser.

Once you are able to parse the XML add methods to extract whatever you need from it.

Note that none of the above involves JSP because code inside a JSP just complicates things. Get it running as a utility class first.

If you have not done any XML processing, go do Sun's XML tutorial first.

Bill
 
Satya Sri
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't want to make a URLConnection and then open the URL as the Application that i have presently has got some thread stuck issues with opening URL connections from the Weblogic App server that it already hosted on.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then how do you plan on getting the XML into your application?
 
Satya Sri
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is the question that i had. I have a URL and can get the XML by hitting the URL, but i do not want to make a URLConnection. So is there any other approach to get the XML other than using URLConnection ?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If it's only available as a web resource (URL) and you don't want to access it as a web resource, I don't know what other options you have.

Can you explain the treading issue that you're having?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!