Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to send user input to servlet

 
Ghazala Islam
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As we send parameters and their values with hyperlink e.g http://
.....?param=value, in this case value is constant,but if we want to send user input not hard coded value in a text field,how can we capture this value?
 
Bosun Bello
Ranch Hand
Posts: 1510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use request.getParameter and request.getparameterValues to get the parameters sent in from the submission of your form.

Bosun
 
Ghazala Islam
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yoy didn't get my point,I'm asking how to send value that is not constant i.e user input
<input type = text name = param >
it doesn't have value clause,when user will enter date I want to send that value with url address.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have the following form:
<FORM ACTION="somepage.jsp" METHOD="GET">
<INPUT TYPE="text" NAME="paramOne">
</FORM>
If the user enters the value valueOne, then the following page will be requested:
somepage.jsp?paramOne=valueOne.
If the form method is GET, the form values are tacked on as query parameters. If you use POST, they are sent as post parameters. Either way, they are available via the request object as parameters.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic