程序为什么不能这么写?

lattile 2002-08-18 02:09:17
<%@ page contentType="text/html; charset=GBK" %>
<html>
<head>
<title>
Jsp1
</title>
</head>
<body>
<%@ page language="Java"%>
<%
String str=request.getParameter("form1");
if(str.equals("")) then
{
out.println("<form name="form1" action= "main.jsp" method=post>");
out.println("<SELECT id=select1 name=select1 style="HEIGHT: 22px; WIDTH: 97px"> <OPTION
selected value=1>身份证号</OPTION><OPTION value=2>姓名</OPTION></SELECT><br>");
out.println("<input type="text" name="cx"><br>");
out.println("<input type=submit value="go">");
out.println("</form>");
}

else{
String cx=request.getParameter("cx");
String selct=request.getParameter("select1");
session.setAttribute("Cx",cx);
session.setAttribute("Selct",selct);
response.sendRedirect("search.jsp");}
%>


</body>
</html>
...全文
92 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
gtfcccq 2002-08-18
  • 打赏
  • 举报
回复
你的接受参数是该是
String str=new String(request.getParameter("form1").getBytes("8859_1")).trim()
stronake 2002-08-18
  • 打赏
  • 举报
回复
如果有错误, 应该是在你第一次运行该 JSP的时候,因为request.getParameter("form1"); 获取不到 form1 这个参数, 所以会产生错误。

81,094

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧