I have created one jsp form which contains the username textfield. On the click of submit button it pass on to servlet and read parameter and display on the screen.
I want to generate a querystring of username with the url.
Can anyone tell me how can i do that??
The following example will add the
usernamefield in the querystring of the request URL.Note that there’s no
method. It defaults toGETalready, which means that all form data is passed by URL.If you still don’t see the querystring in the request URL, then it means that your servlet is performing a redirect after submit.
The enduser will then see the redirected URL in browser address bar instead. If you don’t include the querystring in the redirect URL, then the enduser will indeed not see it at all.
You should either be doing a
forward()instead,or append the query string yourself: