• Post Reply Bookmark Topic Watch Topic
  • New Topic

Use an xml document which is dynamically created by Servlet/JSP  RSS feed

 
Ali Hadian
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm designing a web page and I need to use Javascript to read a XML document and fill some parts of the page with it.

The problem is: "The XML should be created dynamically by Servlet/JSp/any_j2EE_server_side_tool."
Because: "The xml is customized for each user and his preferences"

Now, What is the solution?
what shall I code on server?
what in the JavaScirpt code?
which technology best fits for me? (JSP? servlet? ...?)

Please guide me in a step-by-step manner. please (if possible) show me some lines of code)

Complementary Question:
In the client side code, is it possible to avoid AJAX-style code? (Such that the javascript use the XML directly and do not need to request it from server). in the other word, I prefer that the browser download the XML itself.

Thanks in advance.
 
Tay Thotheolh
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are going to access Java based technology like servlets to create XML documents, it's possible. Anyway, you are going to create Servlet / JSP so why not make use of it ?

You can get the servlet to do normal xml stuff.

You can use javax.xml , org.w3c packages to handle XML related as though handling them for normal desktop clients.

In your web app project, you may want to include xml packages like Apache Xerxes to your class path if you think Xerxes is better then the standard javax.xml packages.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Such that the javascript use the XML directly


It would be much simpler to write the data directly into the web page as JavaScript variables. Look for tutorials on JSON - JavaScript Object Notation.

Is this a class assignment that requires XML?

Bill
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!