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 |
Explain about method local inner classes or local inner classes in java?
Can substring create new object?
What is the this keyword?
what are the difference between Java and .Net?
What is the argument in java?
How do you add an arraylist to an array in java?
Can we have a try block without catch block?
What are packages in java?
Explain difference between final, finally and finalize?
What is array length in java?
How does callback work in java?
What are data types in oop?