在我們的 Apache httpd.conf組態檔中添加以下行后,我們的servlet生成的 html 代碼不會被瀏覽器正確解釋,但它的 html 代碼顯示為純文本:
Header set X-Content-Type-Options nosniff
從無到有,將以下標頭添加到 servlet 生成的代碼中:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
這都不起作用:
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1; X-Content-Type-Options=nosniff" />
任何幫助將不勝感激。
uj5u.com熱心網友回復:
最后,對我來說,這可以完成作業:
httpServletResponse.setContentType("text/html;charset=ISO-8859-1");
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/477159.html
