当前位置:网站首页>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 ChineseExample
<%@ page language="java" contentType="text/html;charset=GBK" pageEncoding="GBK"%>test pageEncoding Set JSP Chinese encoding, pageEncoding property test
边栏推荐
猜你喜欢

Graphical LeetCode - 1161. Maximum Sum of In-Layer Elements (Difficulty: Moderate)

接地气讲解TCP协议和网络程序设计

如何优雅的消除系统重复代码

QML包管理

单片机遥控开关系统设计(结构原理、电路、程序)

Short video SEO search operation customer acquisition system function introduction

玩转NFT夏季:这份工具宝典值得收藏

利用“栈”快速计算——逆波兰表达式

Play NFT summer: this collection of tools is worth collecting

Detailed explanation of Zadig's self-testing and tuning environment technical solution for developers
随机推荐
After an incomplete recovery, the control file has been created or restored, the database must be opened with RESETLOGS, interpreting RESETLOGS.
JSP Taglib指令具有什么功能呢?
【21天学习挑战赛】顺序查找和二分查找的小总结
磁盘与文件系统管理
扑克牌问题
好好活就是做有意义的事,有意义的事就是好好活
Short video SEO search operation customer acquisition system function introduction
电机原理动图合集
security cross-domain configuration
background-image使用
Cash Ⅱ LeetCode_518_ change
Keepalived 高可用的三种路由方案
Short video seo search optimization main content
众筹DAO“枯萎”的缩影:曾拍下《沙丘》未出版手稿的Spice DAO解散
使用 Zadig 交付云原生微服务应用
TCL: Pin Constraints Using the tcl Scripting Language in Quartus
Collection of NFT tools
零基础如何学习单片机,一位入门者的进阶路径,可参考
面试必问的HashCode技术内幕
Unknown CMake command “add_action_files“