正阳20141029 2015-08-12 09:01 采纳率: 66.7%
浏览 1565
已采纳

JSP的inclide指令出错!

jsp_include.jsp页面:

  <%@ include file="static.html" %>
  <% // 静态包含只是把文件包含进来! %>
  <a href="action.jsp">goto two ——></a>
  <br>
  <!-- 超链接转到action.jsp 文件和动态包含该文件显示是不同的 -->
  this examples show include works!
  <br>
  <!-- 动态包含文件并传递参数 -->
  <jsp:include page="action.jsp" flush="true">
        <jsp:param name="a1" value="<%=request.getParameter("name") %>"/>
        <jsp:param name="a2" value="<%=request.getParameter("password") %>"/>
  </jsp:include>>

static.html页面:

  <body>
   <form method="post" action="jsp_include.jsp">
   <table>
        <tr>
            <td>please input your name:</td>
            <td><input type="text" name="name"></td>
        </tr>
        <tr>
            <td>input your password:</td>
            <td><input type="password" name="password"></td>
        </tr>
        <tr>
            <td></td>
            <td><input type="submit" value="login"></td>
        </tr>
   </table>
   </form>
  </body>

action.jsp页面:

    this is a1=<%=request.getParameter("a1") %>
    <br>
    this is a2=<%=request.getParameter("a2") %>
    <br>
    <% out.println("hello from action.jsp"); %>

jsp_includ.jsp出错为:
图片说明
请各位亲们看一下怎么改才能正常运行!

  • 写回答

2条回答 默认 最新

  • lhl_lqc 2015-08-12 09:09
    关注

    把request.getParameter("name")和另外一个的双引号改成单引号即可。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作