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 are variables important in research?
Explain what access modifiers can be used for methods?
What is native code?
Is the empty set a singleton?
How do you sort arraylist in descending order?
What is the size of string?
What do you understand by soft reference?
Describe method overriding
What is a generic type?
Why charat is used in java?
Describe how to implement singleton design pattern in struts.
What is your platform’s default character encoding?
What is structure of java heap? What is perm gen space in heap?
What if I write static public void instead of public static void in java?
How to retrieve data from database in java using arraylist?