希望大家帮我看看怎样改这个程序,谢谢!
我按书作了以下的三个文件
1:static.html文件代码是:
<html>
<body>
<form method=post action="jsp_include.jsp">
<table>
<tr>
<td>please input your name:</td></tr>
<tr><td>
<input type=text name=name>
</td></tr>
<tr><td>input you password:</td>
<td>
<input type=text name=password>
</td>
</tr>
<tr>
<td>
<input type=submit value=login>
</td>
</tr>
</table>
</body>
</html>
第二个:jsp_include.jsp 代码是:
<%@ page contentType="text/html; charset=gb2312" language="java" %>
<html>
<body>
<%@ include file="static.html" %>
<a href="two.jsp">goto two--></a><br>
this examples show include works
<jsp:include page="two.jsp" flush="true">
<jsp:param name="a1" value="<%=request.getParameter("name")%>" />
<jsp:param name="a2" value="<%=request.getParameter("password")%>" />
</jsp:include>
</body>
</html>
第三个:two.jsp
<%@ page contentType="text/html; charset=gb2312" language="java" %>
<br>
this is a1=<%=request.getParameter("a1")%>
<br>
this is a2=<%=request.getParameter("a2")%>
<br>
<% out.println("hello from two.jsp");%>
在ie中运行如下:
please input your name:
input you password:
this examples show include works 举例说明include的工作原理:
this is a1=null
this is a2=null
hello from two.jsp
input you password:
this examples show include works 举例说明include的工作原理:
this is a1=null
this is a2=null
hello from two.jsp
但当我从please input your name: 后面的文本框输入中文时this is a1=后面却显示乱码,这是为什么?
能不能让它也显示中文?
请各位高手给我解释一下,谢谢了