I tried to do in JSP action will determine the value of a text field and saw no action request.setParameter
. I tried to search online solutions and unfortunately I did not find.
I'd love to help, thanks in advance.
I tried to do in JSP action will determine the value of a text field and saw no action request.setParameter
. I tried to search online solutions and unfortunately I did not find.
I'd love to help, thanks in advance.
request.setParameter - is relevant when you're putting some parameter inside the HTML header.
In order to set the text inside the text field you should have a look here: http://www.w3schools.com/tags/tag_input.asp
The input is sent to whatever the your forms 'action' attribute is. Lets say you have the following code
<form action="login.jsp" method="post">
<lable><b>Username</b></label>
<input type="text" name="username">
<label><b>Password</b></label>
<input type="password" name="password">
<button type="submit">Login</button>
</form>
This means that, when your form is submitted, your login.jsp receives a POST request with those variables, these are accessible via the request (HttpServletRequest) object
For example, with the above code, you could use request.getParamater("username")
to get the input supplied in the username field.