'JSP file and button value
I have a JSP file. Inside that file I want to take the value when the button is pressed.
<button value="Honduras" type="submit" name="add" class="btn btn-primary">Add to Cart</a>
I am trying to extract value="Honduras" when button with name="add" is pressed.
String productName = request.getParameter("add"); //Expected productName="Honduras"
But I get the following error which refers to the line above:
Message An exception occurred processing [/index.jsp] at line [68]
Any thoughts?
Solution 1:[1]
Your JSP line:
<button
value="Honduras"
type="submit"
name="add"
class="btn btn-primary">
Add to Cart
</a>
Uses a button to open the tag, but uses a a to close the tag
Not sure if this is the issue, but it is incorrect
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Big Guy |
