简体   繁体   English

JSP 页面指令

[英]JSP Page Directive

I have 2 difference page directive codes in my jsp, i don't know what is the difference between contentType , charset , and pageEncoding , i read thruOracle JSP Globalization Support but didn't understand quite well , can anyone explain the difference in simpler way?我的 jsp 中有 2 个不同的页面指令代码,我不知道contentTypecharsetpageEncoding之间有什么区别,我通过Oracle JSP Globalization Support阅读了但不太明白,谁能解释更简单的区别道路?

<%@ page contentType="text/html;charset=GBK"%>

VERSUS相对

<%@page contentType="text/html;charset=GBK" pageEncoding="GBK"%>

http://www.satollo.net/jsp-and-the-content-type-charset-and-the-page-encoding-attribute http://www.satollo.net/jsp-and-the-content-type-charset-and-the-page-encoding-attribute

ContentType charset内容类型字符集

The contentType charset is how the servlet container which runs the JSP must send to the browser the text generated by the page. contentType 字符集是运行 JSP 的 servlet 容器必须将页面生成的文本发送到浏览器的方式。

PageEncoding页面编码

The pageEncoding directive is used to correctly read the JSP from the file system. pageEncoding 指令用于从文件系统正确读取 JSP。 Since even the JSP is a text but a file is a sequence of bytes on disk, it can be correctly read only knowing the charset to use.由于即使 JSP 是文本,但文件是磁盘上的字节序列,因此只有知道要使用的字符集才能正确读取。

Then:然后:

ContentType charset: How the client have to interpret the file ContentType 字符集:客户端必须如何解释文件

PageEncoding: How to read the jsp from the filesystem PageEncoding:如何从文件系统中读取 jsp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM