当前位置: 代码迷 >> Java Web开发 >> jsp报String literal is not properly closed by a double-quote解决方法
  详细解决方案

jsp报String literal is not properly closed by a double-quote解决方法

热度:1016   发布时间:2016-04-17 10:30:56.0
jsp报String literal is not properly closed by a double-quote
请各位高人解答一下

<%@page language="java" import="java.util.*" pageEncoding="gbk" %>
<%
String username =(String)session.getAttribute("username");
if(username == null) {
out.println("<script type=\"text/javascript\">");
out.println("alert(\"您还没登录,请登录后再下载\");");
out.println("open(\"login.jsp\",\"_self\");");
out.println("</script>");
}else{
out.println("欢迎会员,请下载");
out.println("<a href=\"logout.jsp\”>退出登录</a>");
}
%>

报错是

exception 

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 2 in the jsp file: /doDownload.jsp
Generated servlet error:
String literal is not properly closed by a double-quote


谢谢了个位大侠!这是怎么回事?

------解决方案--------------------
你这样,里层的双引号全部换成单引号试试。
------解决方案--------------------
探讨

引用:

你这样,里层的双引号全部换成单引号试试。


你好,想问一下,
1,我换成单引号中文会变乱码?怎么调一下?
2,改回双引号还是报同样错误,麻烦解释一下原因!
不甚感激!

代码迷推荐解决方案:org.apache.jasper.JasperException: Unable to compile class,http://www.daimami.com/search?q=2308
  相关解决方案