As you can see here that I have a text box with three submit buttons each redirecting to a different jsp page, however in those jsp pages, when I do request.getParameter("bid"), all I get is null... How can I fix this?

<!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>

Recommended Answers

All 3 Replies

first of all what the javascript methods that you have at the onclick do, and second why don't you submit without the onclick() ? Since it is type="submit" once the button is clicked the form will be submitted anyway.

first of all what the javascript methods that you have at the onclick do, and second why don't you submit without the onclick() ? Since it is type="submit" once the button is clicked the form will be submitted anyway.

Yeah, I agree with javaAddict. I don't think you will need the onclick() method for the button anymore. Since you have already declared a action "rent.jsp" for your form.
Your request.getParameters call should be able to work w/o a problem unless your onclick() methods does something else.

unless your onclick() methods does something else.

That is why I asked for the code of the onclick() methods. He may be going to the other jsp in some way that doesn't pass the parameters at the request.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.