Hi

        Be sure the encoding of the response in the JSP page match the
encoding type in the xml (the encoding attribute). You could have problems
with this. The encoding describes how the characters are represented (bye,
bye, ASCII). Select first an encoding with regards to your app language.

        I generate xml from a JSP page. With the contentType set to
'text/xml' the browser will treat the response as XML.

        To select the encoding of the response I used
'contentType="text/xml; charset=UTF-8"' or whatever encoding you want. 

        This code will generate XML from JSP:


<%@ page language = "java"  import = "your jars" contentType="text/xml;
charset=iso-8859-1" %>
<%
        String salida = new String("<?xml version=\"1.0\"
encoding=\"iso-8859-1\" standalone=\"yes\"?><messages><message id=\"1\"
to=\"123456\" from=\"654321\" msg=\"My message\"
status=\"1\"/></messages>");

        out.println(salida);
%>
        
        To incorporate your data inbetween, you could do many things:

        - Complete the whole string before you println it.
        - Combine distincs println and use <%= %> tags to print
database-specific data.
        - If you need such a behavior in many pages, I recommend you to
implement it with a class. 
        - Create a custom tag 
        

        Hope this helps.

        Himar Carmona Delgado
        Analista - Programador
        
............................................................................
.......................
        DESIC, S.L. (Desarrollos y Sistemas Inform�ticos Canarios, S.L.)
        Pedro de Vera, 36, 2� A - 35003 - Las Palmas de Gran Canaria -
Espa�a
        Telf.: +34 928 374 026   Fax: +34 928 374 028
        [EMAIL PROTECTED]


-----Mensaje original-----
De: Jan Aren� [mailto:[EMAIL PROTECTED]]
Enviado el: viernes, 12 de julio de 2002 13:36
Para: [EMAIL PROTECTED]
Asunto: XML response


Hi

I have a problem regarding a XML response. One of our clients need to get a
response from our Web server in XML format, and I know "nothing" about XML.
Ok, I know some teori but not so I could do something useful.

What I need is to generate a response message like this
(in their words: "The response from your server could look like this")

<?xml version="1.0" encoding="iso-8859-1" standalone="yes"?>
<messages>
<message id="1" to="123456" from="654321" msg="My message"
status="1"/>
</messages>

I guess I should generate the String and send it back as a response somehow,
instead of the ordinary HTTP response?

Please help

Regards Jan Aren�

===========================================================================
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

Reply via email to