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 |
Difference between throw and throws?
Can we write class inside a class in java?
What are the uses of final, finally and finalize in java?
2 Answers Agiline, FINO PayTech, HCL,
Is string a data type in java?
What is the difference between pageContext and page implicit objects in jsp?
9 Answers Gspann Technologies, Merrill Lynch, Polaris,
What are the major drawbacks of external iteration?
What is binary tree in java?
Implementations of set interface?
What are inbuilt functions in java?
How big is a pointer?
What are the names of Component subclasses that support painting?
what is the use of finalize()Method please explain with an example