开发者

Why Tomcat always return "text/html;"? [closed]

开发者 https://www.devze.com 2023-02-01 23:50 出处:网络
It's difficult to tell what is being asked here. This question is a开发者_JS百科mbiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. F
It's difficult to tell what is being asked here. This question is a开发者_JS百科mbiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 years ago.

Tomcat always returns http header Content-Type as "text/html;charset=ISO-8859-1", if I set it in my JSP page via 'response.setContentType("application/xml")' or <%@page contentType="application/xml" %> still same. I use Tomcat 7.0.5, but it also occurs in Tomcat 6 and 5?


You've to define some content type, not an empty one. If it's supposed to be generic text/plain content, then do so:

<%@page contentType="text/plain" %>

You can find an overview of most common content types here.


Check you're setting the content type before sending any output.

0

精彩评论

暂无评论...
验证码 换一张
取 消