how to pass parameter from servlet to html form

Answers were Sorted based on User's Feedback



how to pass parameter from servlet to html form..

Answer / shymax

Either use beans ...or use session.setAttribute
("Yourpara",paravalue) in Servlet and ..get in HTML in
Scriplet as session.getAttribute("Yourpara");

Hope this solve the problem

Is This Answer Correct ?    13 Yes 4 No

how to pass parameter from servlet to html form..

Answer / haneef

By the Hidden form fields..

we can set the name and values here

<input type="hidden" name="uName" value="xxx" />

this way, u can send u r parameters to html

(or) by cookies
Cookie c1=new Cookie("uName","xxx");
response.addCookie(c1);

Is This Answer Correct ?    8 Yes 1 No

how to pass parameter from servlet to html form..

Answer / amit ghosh

its simple... use request diapatcher

RequestDispatcher rd = request.getRequestDispatch("url?
newparam=newvalue");
rd.forward(request, response);

Is This Answer Correct ?    9 Yes 2 No

how to pass parameter from servlet to html form..

Answer / sachin s

You can also use HtppSessio, create a new session variable
and set the value and get the same value in HTML. However
this should be avoided if you want to pass to many
parameters.

Also,remember that Session variable should be flushed off
after the use, thats a good practise.

Is This Answer Correct ?    4 Yes 3 No

Post New Answer

More Servlets Interview Questions

How to make servlet thread safe?

9 Answers   Frisco Tech, InfoVista, WipSys Technologies,


Define the life cycle of a servlets.

0 Answers  


If a servlet is not properly initialized, what exception may be thrown?

0 Answers  


When a client request is sent to the servlet container, how does the container choose which servlet to invoke?

0 Answers  


Should I override the service() method?

0 Answers  






where the generated jsp source file are stored?

7 Answers   HCL,


How will two or three servlets interact or communicate with each other?

0 Answers  


What is the capacity that doGet method can send to the server?

5 Answers  


What is api in servlet?

0 Answers  


How do u authorize and authenticate without <auth> of web.xml

1 Answers   Bosch,


Write a program to show the functionality of servlets.

0 Answers  


In the servlets, we are having a web page that is invoking servlets ,username and password? which is checks in database? Suppose the second page also if we want to verify

0 Answers  


Categories