I'm new to JSP, and trying to make the transition from ASP.NET (which is quite different).
I've basically got a set of html input buttons. Each of these buttons should redirect to the same page when pressed. However, I would like to pass a parameter too, i.e. I would want the page to behave differently based on which button initiated the redirection.
What I've done so far is to wrap the buttons in a form, which communicates with a servlet's GET method. From here, I can see which button was pressed.
I would now like to redirect to the page and also pass the value of the button which was pressed. How can this be done? The page I need to redirect to is a JSP page.
My code:
HTML page:
<form action="DashboardServlet" method="get">
<input type="button" value="Button1" name="button1"/>
<input type="button" value="Button2" name="button2"/>
</form>
DashboardServlet
....
// If-statements to see what button was pressed
....
EDIT: I was thinking of using a session to store the value. Would this be valid?