当前位置:网站首页>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
边栏推荐
- security跨域配置
- 具有通信时延的多自主体系统时变参考输入的平均一致性跟踪
- Using the "stack" fast computing -- reverse polish expression
- 磁盘与文件系统管理
- Keepalived 高可用的三种路由方案
- Detailed explanation of Zadig's self-testing and tuning environment technical solution for developers
- ROS dynamic parameters
- JSP request对象功能详解说明
- OpenCV DNN blogFromImage() detailed explanation
- 中缀转后缀、前缀表达式快速解决办法
猜你喜欢
随机推荐
background-image使用
基于数据驱动的变电站巡检机器人自抗扰控制
中缀转后缀、前缀表达式快速解决办法
Collection of NFT tools
Short video seo search optimization main content
Deliver cloud-native microservices applications with Zadig
08-SDRAM:汇总
如何发现新的潜力项目?工具推荐
双队列实现栈?双栈实现队列?
LeetCode_518_零钱兑换Ⅱ
Excel导入和导出
信息物理系统状态估计与传感器攻击检测
08-SDRAM: Summary
security CSRF Vulnerability Protection
Play NFT summer: this collection of tools is worth collecting
基于超参数自动寻优的工控网络入侵检测
Axure tutorial - the new base (small white strongly recommended!!!)
2022/08/01 学习笔记 (day21) 泛型和枚举
解析正则表达式的底层实现原理
OpenCV DNN blogFromImage()详解