当前位置:网站首页>How does JSP use the page command to make the JSP file support Chinese encoding?
How does JSP use the page command to make the JSP file support Chinese encoding?
2022-08-02 00:18:00 【qq_25073223】
From:
jsp introduction:
The full name of JSP is Java Server Pages, which is a dynamic web page technology. JSP is actually a file formed by inserting java code and JSP tags into html, and the file name ends with .jsp.In fact, JSP is a servlet.
Writing html in servlet is more painful, and writing JSP is like writing html, but compared with html, html can only provide users with static data, that is, static pages, and Jsp technology allows java to be nested in pagescode to provide users with dynamic data to form dynamic pages.It should be noted that it is best to only write java code for dynamic output in JSP.
JSP workflow
Converting JSP files to .java files and compiling them to .class filesThe process is all completed by tomcat. There is a translation engine inside tomcat. When the JSP page is accessed for the first time, the translation engine converts it into a .java file and compiles a .class file.Then run the class file again.
The html code in JSP will be translated into out.write() in servlet
The following describes the method sharing of JSP files supporting Chinese encoding, as shown below:
Implementation ideas: 1. Use the pageEncoding attribute to set the encoding method in the page instruction (using the JSP file itself to support Chinese) 2. Set the charset value in the contentType,Use the client to support Chinese
Example
<%@ page language="java" contentType="text/html;charset=GBK" pageEncoding="GBK"%>test pageEncoding Set JSP Chinese encoding, pageEncoding property test
边栏推荐
猜你喜欢
随机推荐
go语言标准库fmt包怎么使用
LeetCode_518_零钱兑换Ⅱ
08-SDRAM:汇总
Arduino 基础语法
Unity—四元数、欧拉角API+坐标系统
security跨域配置
ROS dynamic parameters
短视频SEO搜索运营获客系统功能介绍
mysql8安装make报错如何解决
08-SDRAM: Summary
为什么要使用MQ消息中间件?这几个问题必须拿下
重装腾讯云云监控后如果对应服务不存在可通过sc.exe命令添加服务
Deliver cloud-native microservices applications with Zadig
QML package management
22. The support vector machine (SVM), gaussian kernel function
在不完全恢复、控制文件被创建或还原后,必须使用 RESETLOGS 打开数据库,解释 RESETLOGS.
LeetCode_279_完全平方数
Win11如何获得最佳电源效率?
JSP out.println()方法具有什么功能呢?
OpenCV DNN blogFromImage() detailed explanation