how can i cal servlet from jsp page?how can i pass
variablesfrom the jsp that servlet can access?
Answer Posted / ranjani
By using JSP forward attriputes within the html tag we can
just forward our page to servlet.or by using
response.sendRedirect()method we can call servlet page.
for example
-----------
<jsp:forward page="/relativepath/YourServlet" /> or
response.sendRedirect("http://path/YourServlet").
We can also pass the parameters in the same way to the
servlet
for example
-----------
<jsp:forward page=/relativepath/YourServlet>
<jsp:param name="name1" value="value1" />
<jsp:param name="name2" value="value2" />
</jsp:forward>
You may also pass parameters to your servlet by specifying
response.sendRedirect("http://path/YourServlet?
param1=val1").
| Is This Answer Correct ? | 11 Yes | 1 No |
Post New Answer View All Answers
What is the common usage of serialization? What exceptions occur during serialization?
What is array list in java?
What is listnode in java?
What is re-factoring in software?
Explain methods specific to list interface?
Can we use string in switch case in java?
What is void class in java?
What do you mean by constructor?
What is a line break?
Can an integer be null java?
What are the various access specifiers in java?
Can we overload destructor in java?
What are the two environment variables that must be set in order to run any java programs?
What is a key in java?
How many types of equations are there?