问题描述
- 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"); %>
解决方案
把request.getParameter("name")和另外一个的双引号改成单引号即可。
解决方案二:
JSP指令元素
解决方案三:
把value="" 改成value=''.
时间: 2024-10-02 11:42:00