If you're directly in JavaScript code, it's good to show multiple lines of direct add \ n:
Copy Code code as follows:
Alert ("First row \ second row");
But in Java code, \ n is not possible, \\n can display multiple lines!!!
Copy Code code as follows:
String strtemp= "History answer Report: \\n" + "you answered correctly" +rddata.getccnt () + "\\n" + "You have" +rddata.getbcnt () + "no answer \\n" + "you answer wrong" + RDDATA.GETWCNT () + "question \\n";
Out.print ("<script> alert ('" +strtemp+ "); window.location= ' index.jsp ' </script>");
First declare a string variable (note that wrapping is \\n!!!. , and then put it in alert, and then the page jumps to the homepage.
This is the test result:
This is a special character code in javascript:
Copy Code code as follows:
Code outputs
\ ' Single quote
\ "Double Quote
\ Backslash
\ New Line
\ r Carriage Return
\ t tab
\b Backspace
\f Form Feed