It really depends on what affect you are looking for.

A: you want the user to download an XML file as a data file
Answer 1:
Write a servlet to build the XML document, set the attachment HTTP
header to the XML file name and then write the XML document to the
HttpServletResponse's output stream

Answer 2:
Write a custom UI component and renderer to spit XML back from your
JSF page instead of HTML (there are no XML components that I am
familiar with)

B: you want the user to see an XSLT version of XML data:
Answer: Really the same as A, but you have to put a reference in the
XML to the XSLT on the server.

Answer 3: nothing, facelets or JSF is able to spit XHTML back to the
client, and XHTML is XML using an HTML DTD.

Regarding AJAX: Yes AJAX uses XML, but it generally takes XHTML
content from a server response an injects it into the page. I don't
think this is what you are looking for.

If you use the servlet, it will not have access to the faces context,
so if you don't want to reload the data from the servlet that was
already loaded via JSF, you will have to use a session scoped class
that holds your data that you can access from a standard HttpSession
object (then provide a helper class to load/retrieve the data using
only servlet classes so that it can be used by both JSF and the
servlet).

There will be other ways, depending on exactly what you want to do.
Anyone else with a better suggestion?

On 3/3/06, Yasushi Okubo <[EMAIL PROTECTED]> wrote:
> Hi, experts
>
> I have a design question for how to push/display DOM/XML page on
> client.  There is a table data stored in an array that is displayed with
> datascroller.  I want to add a function to export  this data  in xml
> format on client.
> I  am thinking to convert an array to DOM  then use  write function to
> covert it to XML file.
> Could someone advise me the best way to display this xml file on the
> client side without writing it as a file in the directory on the server
> ?  It sounds ajax can to it easily, but do not know how to do yet.
>
> Thanks,
> yasushi
>
>

Reply via email to