how can i cal servlet from jsp page?how can i pass
variablesfrom the jsp that servlet can access?
Answer / 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 |
Why do we create threads in java?
Is java call by value?
Write a program for recursive Traverse?
What are the advantages of exception handling?
What are unchecked exceptions in java?
Does java allow overriding static methods ?
What is jagged array in java?
how many types of cloning?
Can we have any code between try and catch blocks?
Explain about anonymous inner classes ?
why string is not taking as primitive datatypes but we r taking it as a class? why explain it?
explain the life cycle of thread?
10 Answers CTS, NIIT, TCS,