String Literal is not properly closed by a double-quote error example

Source: Internet
Author: User

Example 1:

The Code is as follows: Click Update to jump to this page and an error is returned !! Experts help you !! If this parameter is not included, no error is returned! However, the arttiel parameter must be included! <% @ Page contenttype = "text/html; charset = gb2312" Language = "Java" Import = "Java. SQL. * "errorpage =" "%> <% @ include file =" connection. JSP "%> <! Doctype HTML public "-// W3C // dtd html 4.01 transitional // en" "http://www.w3.org/TR/html4/loose.dtd"> <HTML> 

 

Question added:

This error is returned when the parameter (arttiel) is included. If the parameter is removed, it will be okay, but this parameter must be used !! Out. println ("<SCRIPT> alert ('Update successful! '); Document. Location =/"sousuo. jsp? Arttiel = <% = arttiel %>/"; </SCRIPT>"); if you write it as follows, you can get this parameter, however, an error is returned if you change to <% = %>! Out. println ("<SCRIPT> alert ('Update successful! '); Document. Location =/"sousuo. jsp? Arttiel = 1/"; </SCRIPT> ");

Best Answer

<% = %> Is used to copy data in HTML. Out. println ("<SCRIPT> alert ('Update successful! '); Document. Location =/"sousuo. jsp? Arttiel = "+ arttiel +"/"; </SCRIPT> ");

Example 2:

 

Org. Apache. Jasper. jasperexception: Unable to compile class for JSP:

An error occurred at line: 38 in the JSP file:/jsrz/admin/showrz. jsp
String Literal is not properly closed by a double-quote
35: Statement _ SMT = con. createstatement ();
36: resultset _ rs;
37: String _ SQL;
38: _ SQL = "select * From rzbody where name = '" + name + "';
39: _ rs = _smt.exe cutequery (_ SQL );

Best Answer

Quotation marks _ SQL = "select * From rzbody where name = '" + name + "'" are missing "'";

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.