servlets became file download [message #193118] |
Thu, 14 September 2006 23:22 |
cacheboy
Messages: 21 Registered: August 2006
|
Junior Member |
|
|
All my servlets when ran, Oracle 10g AS treats it as a download instead of html.
In my servlet, I already set
response.setContentType("text/html; charset=UTF-8");
PrintWriter out = response.getWriter();
out.println();
What gives?
After I download the file and open with a text editor, it is showing the html I wanted to show.
Don't have this problem on other Application Server.
Please help. Thanks.
|
|
|
Re: servlets became file download [message #193141 is a reply to message #193118] |
Fri, 15 September 2006 00:56 |
cacheboy
Messages: 21 Registered: August 2006
|
Junior Member |
|
|
Found the error after searching the web for a long time.
PrintWriter out = response.getWriter();
response.setContentType("text/html; charset=UTF-8");
out.println();
Is the problem.
You must setContentType in response before you getWriter for out.
|
|
|