| |

VerySource

 Forgot password?
 Register
Search
View: 894|Reply: 7

How to output quotes "and '

[Copy link]

2

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-3-23 00:30:01
| Show all posts |Read mode
How to output quotation marks "and '? Although\was added to the JAVA program, in the jsp source program that looks at the output, I see the converted characters, such as" it became" instead of a quotation mark ", so The result is document.write (" hh") ;, which makes it impossible to execute.
Reply

Use magic Report

0

Threads

6

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-7-11 00:45:01
| Show all posts
Try to quote the contents of document.write with single quotes
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-7-11 17:15:01
| Show all posts
Try with this
Quoted string.replaceAll("&quot","\"");
Reply

Use magic Report

2

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-7-16 07:00:02
| Show all posts
Still not work, it is strange why some JAVA programs can directly output quotation marks, is it related to the language setting in the JAVA program?
Reply

Use magic Report

0

Threads

23

Posts

13.00

Credits

Newbie

Rank: 1

Credits
13.00

 China

Post time: 2020-7-16 14:45:01
| Show all posts
"\" is an escape at the Java code level.&" is an escape at the HTML code level.
Reply

Use magic Report

2

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-7-26 12:45:01
| Show all posts
Can it directly output the quotation marks when outputting to JSP instead of" ? Only when the quotation marks are seen in the source program of the webpage, the function will execute correctly.
Reply

Use magic Report

0

Threads

9

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-7-26 15:00:01
| Show all posts
document.write('\"This is double quote\".\'This is single quote\'');
Reply

Use magic Report

2

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-7-26 20:00:01
| Show all posts
Found a way, the following procedures are used medicinally, not bean:write:
  <%
List list=(List)request.getAttribute(Constants.MENU_LIST_KEY);
String Menustr="";
for(int i=0;i<=list.size()-1;i++){
Menustr = (String)list.get(i);
out.println(Menustr);
}
%>
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list