Reputation: 136
I am unable to fetch the following data....it always shows null
I have following html page
<html>
<body>
<input type="number" name="quantity" min="1">
<form action="buy.jsp" method=post>
<input type= "submit" value=submit>
</form>
</body>
</html>
And the jsp page
<html>
<body>
<% out.print(request.getParameter("quantity")); %> // it is always returning null
</body>
</html>
Upvotes: 1
Views: 9269
Reputation: 352
Change the code in the first page as follow:
<html>
<body>
<form action="buy.jsp">
<input type="number" name="quantity" min="1">
<input type= "submit" value=submit>
</form>
</body>
</html>
As of the second page, you need to use Param in order to get the data from the first page as follow:
<html>
<head><title> Any Title<\title><\head>
<body>
The Quantity is: ${param.quantity}
</body>
</html>
Upvotes: 0
Reputation: 6111
change your html to one below,
<html>
<body>
<form action="buy.jsp" method=post>
<input type="number" name="quantity" min="1">
<input type= "submit" value=submit>
</form>
</body>
</html>
Upvotes: 1