当前位置:网站首页>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
边栏推荐
猜你喜欢
随机推荐
Async/await principle and execution sequence analysis
After an incomplete recovery, the control file has been created or restored, the database must be opened with RESETLOGS, interpreting RESETLOGS.
Wincc报表教程(SQL数据库的建立,wincc在数据库中保存和查询数据,调用Excel模板把数据保存到指定的位置和打印功能)
07-SDRAM: FIFO control module
Short video SEO optimization tutorial Self-media SEO optimization skills and methods
632. 最小区间
IP核:FIFO
Collection of NFT tools
基于超参数自动寻优的工控网络入侵检测
利用“栈”快速计算——逆波兰表达式
C language Qixi is coming!It's time to show the romance of programmers!
重装腾讯云云监控后如果对应服务不存在可通过sc.exe命令添加服务
JSP如何使用page指令让JSP文件支持中文编码呢?
解析正则表达式的底层实现原理
QML package management
Excel文件读写(创建与解析)
08-SDRAM:汇总
JSP Taglib指令具有什么功能呢?
认识USB、Type-C、闪电、雷电接口
Thymeleaf简介