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 |
What do you mean by ordered and sorted in collections in java?
What is the difference between notify and notifyall method?
what is mutual exclusion? : Java thread
when a servlet sends request for first time it uses the follwing methods a)init b)doget() c)dopost() d)service
what is difference between requestprocessor and request dispatcher?
What restrictions are placed on method overloading in java programming?
What are the types of sockets in java?
If an object reference is set to null, will the garbage collector immediately free the memory held by that object?
Is set thread safe java?
How can a class be accessed, If no access modifiers are declared?
What is Ideal Design of Class?
Difference between static methods, static variables, and static classes in Java.