当前位置:网站首页>Difference between JSP out.print() and out.write() methods
Difference between JSP out.print() and out.write() methods
2022-08-02 00:18:00 【qq_25073223】
From:
JSP outDifference between .print() and out.write() methods
The following describes the difference between the out.print() and out.write() methods, as follows:
Introduction to out.print() and out.write() methods
out.print() and out.write() methods in JSPAll belong to the methods of the abstract subclass JspWriter of the abstract class Writer;The out.print() method belongs to the method in the abstract subclass JspWriter,And out.write() is a method of the parent class Writer.-------------------------------------------------out.print(): The method in the JspWriter class is calledout.writer(): calls the method in its parent Writer class
The difference between the two methods:1. The print method is a subclass of JspWriter, and write is a method defined in the Writer class. 2. The overloaded print method can convert various types of data into strings.The form of output, and the overloaded write method can only output character-related data such as characters, character arrays, and strings. The JspWriter type out object can output strings using both the print method and the write method. 3. If the value of the string objectWhen it is null, the print method will output a string with the content "null" and the write method will throw a NullPointerException exception
Example
Output numbers
<% out.print(98); %>
<% out.write(98); %>-----Run the above code, it will output different information---98-----------------b
边栏推荐
猜你喜欢
随机推荐
contentEditable属性
回顾历史5次经济衰退时期:这一次可能会有何不同?
【Leetcode】2360. Longest Cycle in a Graph
Short video SEO search operation customer acquisition system function introduction
Arduino 基础语法
如何发现新的潜力项目?工具推荐
async/await 原理及执行顺序分析
【解决】win10下emqx启动报错Unable to load emulator DLL、node.db_role = EMQX_NODE__DB_ROLE = core
TCL:在Quartus中使用tcl脚本语言进行管脚约束
短视频SEO优化教程 自媒体SEO优化技巧方法
security CSRF Vulnerability Protection
Zadig 面向开发者的自测联调子环境技术方案详解
一个有些意思的项目--文件夹对比工具(一)
Play NFT summer: this collection of tools is worth collecting
Excel表格数据导入MySQL数据库
ansible模块--copy模块
带你搞懂MySQL隔离级别,两个事务同时操作同一行数据会怎样?
ES中SQL查询详解
After an incomplete recovery, the control file has been created or restored, the database must be opened with RESETLOGS, interpreting RESETLOGS.
【ACWing】230. 排列计数