0
正如你在这里看到的,我有一个带有三个提交按钮的文本框,每个按钮都重定向到不同的jsp页面,但是在那些jsp页面中,当我做request.getParameter(“bid”)时,我得到的全部为空...我怎样才能解决这个最简单的方法?处理表单和多个按钮的文本框
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>View/Modify Student Information</title>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<script type="text/javascript" src="scripts/search.js"></script>
</head>
<body>
<br/>
<div align="center">
<h2>View/Modify Student Information</h2>
<label> Student Banner ID: </label>
<input type="text" name="bid" />
<br/>
<br/>
<form method = "post" action="rent.jsp">
<input type="text" name="bid1" />
<input type="submit" value="Total Rent" onClick="goto_rent()"/>
</form>
<form method = "post" action="adviser.jsp">
<input type="text" name="bid2" />
<input type="submit" value="Adviser Information" onClick="goto_adviser()"/>
</form>
<form method = "post" action="delete_std.jsp">
<input type="text" name="bid3" />
<input type="submit" value="Delete Student" onClick="goto_del()"/>
</form>
</div>
</body>
</html>
除此之外还有其他更简单的方法吗?因为我不知道什么 com.example.StudentServlet是... – 2009-12-10 16:54:13
我想在我的jsp代码中使用request.getParamater(“bid”)而不是
您的出价是$ {param.bid}
– 2009-12-10 16:56:461)它是一个扩展了'javax.servlet.http.HttpServlet'的Java类。我编辑了代码示例以演示更多。 2)它完全一样,但是使用表达式语言而不是十多年前不鼓励的老式脚本。我强烈建议通过一个体面的JSP/Servlet教程,以便你能找到某个地方。 – BalusC 2009-12-10 17:10:55