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’s the difference between applets and standalone program?
What is a numeric string?
What is arrays fill in java?
Can memory leak in java?
What method is used to specify a container's layout in java programming?
Describe the process as to how substring() methodology mechanisms in java.
In java, how we can disallow serialization of variables?
Which is better singleton or static class?
Why isn’t there operator overloading?
What is the return type of the main method?
What are annotations in java?
Is integer a class?
What data structures are used to perform recursion?
What is linkedlist in java?
Which is bigger double or float?