Hi
I have a servlet, that reads an XML file, formats it using an XSLT
stylesheet into a simple HTML table and uses the Response object printwriter
to send the data back to the client browser. The servlet was set up in such
a way that if the customer number is sent as a parameter on the URL (in the
form servlet?customerId=12345), the XML is re-generated from the back end
database and if the customer number is not sent, a previously generated
local copy of the XML is used. The same XSL stylesheet is used in both
cases. Immediately prior to writing to the printwriter I set the output type
with
response.setContentType("application/vnd.ms-excel");
If no parameter is sent, then the results open up in an Excel Spreadsheet as
expected, but if the parameter is sent then the output opens as an HTML
table within the browser. I then changed the servlet so that it used the
locally generated XMl in all cases, and again I see the same results; no
parameter and Excel spreadsheet and with parameter - HTML table. I made a
third change so that I don't even read the request parameters into the
servlet and now everything works as I would expect - I get an Excel
spreadsheet in both cases.
So it appears that somehow that the code "String customerId =
request.getParameter("customerId");" is affecting the output format *if* and
*only if* a parameter is actually passed. My question is - why? and how do I
get around this?
I'm using Suns JDK 1.3, TomCat 3.2 standalone as the servlet engine and IE
5.0 as the brower.
Regards
Roger
"You can lead a horse to water but you can't make him drink,
and shooting the rider because his horse allowed itself to
get dehydrated is not the proper response," Lane Thomas
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html