On Thu, 31 May 2001, Wu, Ying (LNG-CIS) wrote: >> I need to send a string which represents a xml file to browser, I need to >> call response.setContentType("text/xml"). But it is at ActionServlet level >> and is default to "text/html". >> > 1. Any idea? > >Although the controller servlet sets the default output type, this gets >replaced if you forward to a JSP page (or whatever) at the end of your >action. > >> 2. I can do the output at MyAction.perform() level, but how to handle the > return type of this method? > If you are generating the output in your Action itself, you should >return null from your perform() method. This tells the controller >servlet that the response has already been created, so no forwarding is >required.
Does this this mean if I want the perform() method to output a jpg file then I should open an output stream inside the action, ie ServletOutputStream stream = response.getOutputStream() and just write the jpg file to this stream, then at the end of the perform() method return null? Cheers Antony -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>