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
Why should I use abstract class?
What are the major advantages of internal iteration over external iteration?
Give an example of use of pointers in java class.
How do you check if an arraylist is not empty?
What does sprintf return?
Can we overload destructor in java?
Which method cannot be overridden in java?
Is there a sort function in java?
Why do people says “java is robust”?
Is void a type?
Does collectionutils isempty check for null?
What are the classes of java?
What is a method declaration?
What is regex used for?
Can you inherit from an abstract class java?