Hi,

the problem is that I don´t have a string. So the first question is how can
I convert the result to a string? See m example below.

JasDA

-----Ursprüngliche Nachricht-----
Von: Yan Langlois [mailto:[EMAIL PROTECTED] 
Gesendet: Mittwoch, 7. September 2005 00:03
An: xindice-users@xml.apache.org
Betreff: Re: Convert the result of a query after a xslt transformation

Hello,

I have already done this in one of my applications. I added the string 
in the request variable:

in the Java program (servlet):
...
    public void doPost(HttpServletRequest request, HttpServletResponse 
response) throws ServletException, IOException
    {
           ...
           String htmlResponse = "Hello!";
           request.setAttribute("htmlResponse",htmlResponse);
           ...
           RequestDispatcher rd = 
request.getRequestDispatcher("path/to/my/JSP/file");
           rd.forward(request,response);
    }
..

in the JSP file: <%=(String)request.getAttribute("htmlResponse")%> will 
write: "Hello!"

Do not forget that the browser will interpret the String as HTML.

Yan.



Pasche wrote:

> I transform the result of a xindice query by this:
>
>  
>
> javax.xml.transform.TransformerFactory tFactory = 
> javax.xml.transform.TransformerFactory.newInstance();
>
>                                                           
>
> Result res = new StreamResult(System.out);                
>
> Source xsl = new StreamSource(stylesheet);
>
>                                                           
>
> javax.xml.transform.Transformer transformer = 
> tFactory.newTransformer(xsl);
>
> transformer.transform(src, res);
>
>  
>
> As you can see, the result of the transformation is shown in Tomcat 
> (or whatever) console (System.out). Now I want to return this result 
> as a String or whatever because this class is called from a JSP in 
> which I want to put out the result of the transformation.
>
>  
>
> Can anybody help me how I can deliver the Result to a JSP?
>
>  
>
> JasDA
>

Reply via email to