Incomplete solution for using input type=text value=str

Incomplete solution for using input type=text value=str
I encountered a very strange problem today. Look at the following code:
SimpleDateFormat dateFormat = new SimpleDateFormat

Copy code
The code is as follows:
teFormat("yyyy year MM month dd day E ");
String date = dateFormat.format(new Date());

The original intention was to print out XXXX year XX month XX day week X
The problem is in the following code. When I want to get the formatted data, I can only get "XXXX year XX month XX day" when using the value= method, but I can't get the "week X" behind it.

Copy code
The code is as follows:

<td align="left">
<label>
<input type="text" value=<%=date%> disabled />
</label>
</td>

① Later, I thought that it might be an HTML escape problem, so I removed all the spaces in "yyyy年MM月dd日E", and the result was that the value could be obtained normally or changed to "yyyy年MM月dd日-E"
② Another method is to use escape characters to replace the contents of the string to be displayed one by one.

Copy code
The code is as follows:

<%
String result = "";
for (int i = 0; i < date.length(); i++) {
switch (date.charAt(i)) {
case '<':
result += "<";
break;
case '>':
result += ">";
break;
case '&':
result += "&";
break;
case '"':
result += "\"";
break;
case '\'':
result += "'";
break;
case ' ':
result += "&nbsp;";
break;
default:
result += date.charAt(i);
}
}
%>

The references are as follows :
HTML source code to display the result description
&lt; < less than sign or display mark
&gt; > Greater than sign or display mark
&amp; & can be used to display other special characters
&quot; " quotation mark
&reg; ® Registered
&copy; © Copyright
&trade; ™ Trademark
&ensp; Half blank space
&emsp; A blank space
&nbsp; No breaking whitespace

<<:  Display flex arrangement in CSS (layout tool)

>>:  Solution to MySQL 8.0 cannot start 3534

Recommend

Detailed explanation of the difference between in and exists in MySQL

1. Prepare in Advance For your convenience, I cre...

Summary of MySQL injection bypass filtering techniques

First, let’s look at the GIF operation: Case 1: S...

Example code for implementing the wavy water ball effect using CSS

Today I learned a new CSS special effect, the wav...

Text pop-up effects implemented with CSS3

Achieve resultsImplementation Code html <div&g...

An Incomplete Guide to JavaScript Toolchain

Table of contents Overview Static type checking C...

Vue implements login type switching

This article example shares the specific code of ...

MySQL: Data Integrity

Data integrity is divided into: entity integrity,...

Super detailed MySQL usage specification sharing

Recently, there have been many database-related o...

Why is your like statement not indexed?

Preface This article aims to explain the most bor...

Install and configure MySQL under Linux

System: Ubuntu 16.04LTS 1\Download mysql-5.7.18-l...

JavaScript simulation calculator

This article shares the specific code of JavaScri...

Newbies quickly learn the steps to create website icons

<br />Original URL: http://www.lxdong.com/po...

Code analysis of synchronous and asynchronous setState issues in React

React originated as an internal project at Facebo...