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 Classloader in Java?
What is java and their uses?
What is the buffer limit?
Why do we override tostring method in java?
What is the difference between a switch statement and an if statement?
What is the default value of the local variables?
I don’t want my class to be inherited by any other class. What should I do?
What are the string methods in java?
How do you check if two given string are anagrams?
What is the primitive type byte?
List some features of the abstract class.
What is the benefit of abstract class?
What is the structure of java?
What is skeleton and stub? What is the purpose of those?
Outline the major features of java.