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 do you mean by aggregation?
Why string is not a wrapper class?
What is a variable declaration?
What will be the default values of all the elements of an array defined as an instance variable?
What are the parts of a method?
What is the importance of finally block in exception handling?
What is variable declaration and definition?
Can java run on google chrome?
Describe method overriding
Explain java coding standards for constants?
What is a method type?
Explain the public class modifier?
How does varargs work in java?
If I only change the return type, does the method become overloaded?
What does %d do in java?