smp1.html代码:<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<!--<meta name="description" content="密码,登陆">
<meta name="keywords" content="密码,登陆">-->
<title>静态文件</title></head>
<body>
<form name="fr2" method="post" action="menu7.jsp">
<p align="center">用户名:
<input type="text" name="username" id="username">
密码:
<input type="password" name="password" id="password">
</p>
<p align="center">
<input type="submit" value="提交" name="sub1">
</p></form>
</body></html>
menu6.jsp<%@ page contentType="text/html;charset=gb2312" language="java"%>
<html>
<head>
<title>动态文件</title>
</head>
<body>
动态文件内容:
<br>
用户名:<%=request.getParameter("username")%>
<br>
密码:<%=request.getParameter("password")%>
<br>
<% out.print("这是menu6.jsp的内容");%>
</body>
</html>menu7.jsp
<%@ page contentType="text/html;charset=gb2312" %>
<html>
<head>
<title>menu7.jsp文件</title>
</head>
<body>
<%@ include file="smp1.html"%>
<%//把文件包含了进来%>
<a href="menu6.jsp">转向menu6.jsp文件</a>
举例说明include的原理
<br >
<jsp:include page="menu6.jsp" flush="true">
<jsp:param name="username" value="<%=request.getParameter("username")%>"/>
<jsp:param name="password" value="<%=request.getParameter("password")%>"/>
</jsp:include>
</body>
</html>
总是提示以下错误: /menu7.jsp(13,37) Attribute value request.getParameter("username") is quoted with " which must be escaped when used within the value
改了N次也没找到错误,希望大家帮忙看下,谢了!

解决方案 »

  1.   

    你先测试一下
    username和Password  smp1.html输入的数据
    能否在menu6.jsp 页面显示
      

  2.   

    smp1.html
    文件和menu7.jsp
    的编码格式不一致!!!!!
      

  3.   

    还有就是你在
    <%@ page contentType="text/html;charset=gb2312" %> 
    <html> 
    <head> 
    <title>menu7.jsp文件 </title> 
    </head> 
    <body> 
    <%@ include file="smp1.html"%> 
    <%//把文件包含了进来%> 
    <a href="menu6.jsp">转向menu6.jsp文件 </a> 
    举例说明include的原理 
    <br > 这样好像不行吧,
    还有你没有必要在menu7.jsp 页面把输入页面包含进来啊
    你可以像上面一样使用超连接跳转来实现
      

  4.   

    smp1.html输入的内容不可以在menu6.jsp中显示吧,它是连接到menu7.jsp的。<%@ include file="smp1.html"%> 我就是把它包含进来的,smp1.hmtl与menu.jsp格式一样呀,没什么不同呀。
      

  5.   

    用<jsp:include page="smp1.html">试试,用你那文件全部包含了进来,不行的。
      

  6.   

    你的smp1.html中把form提交给了menu7.jsp ,而你在menu7.jsp 中包含了smp1.html代码又include了menu6.jsp,我看不懂你这样写的思路是什么,那你先运行哪个文件了,不太明白
      

  7.   

    用 <jsp:include page="smp1.html">试试,用你那文件全部包含了进来,不行的。
      

  8.   

    用 <jsp:include page="smp1.html">试试,用你那文件全部包含了进来,不行的。
      

  9.   

    <%include file=""%>//再编译前include,也就是把文件先包含进来,再一起编译
    <jsp:include page="">//先将这个page编译完,再包含进来
      

  10.   

    我觉得你的MENU7中include了smp1.html然后你在menu7中用了动作标签到menu6但是问题是 你的smp1.html中的那2个参数在你的menu7中根本得不到的 因为你没有提交 怎么可能会在request.getparater中得到那2个参数的值然后传递给menu6呢?所以参数都没传过去 menu6里面根本就不会返回结果啊
      

  11.   

    第一个说的是正确的 但是第2个不是说编译完在包含进来 而是说把page编译运行完处理的结果返回到包含它的页面
      

  12.   

    <%include file=""%>//再编译前include,也就是把文件先包含进来,再一起编译 
    <jsp:include page="">//先将这个page编译完,再包含进来 楼主还是搞清楚上面两种方式的区别吧,可以在tomcat中查看有jsp生成的java文档,一种生成的是一个文档,一个是生成2个文档,搞清楚这个了就明白为什么不行了。其实你的错误原因也就在这里面
      

  13.   

    menu7.jsp(13,37) Attribute value request.getParameter("username") is quoted with " which must be escaped when used within the value 哪里有引号错误
      

  14.   

    “将value后面的"username”改为\"username\" 具体原由有可能是tomcat的版本不同导致的。jsp在编译jsp页面时,将 <%=request.getParameter("searchtype")%>作为变量进行处理。因此,遇到里面的"会报错。”不过我这个貌似跟版本关系不大,远程主机和本地都是tomcat6.0的,本地运行没问题,远程传上去就出错了,不过也不能确定,本地是6.0.13的远程是6.0.18的这个是正确的解决方法,我试过了。