日期:2014-05-17  浏览次数:20845 次

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.aiyiweb.com/j2ee/2308.html