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 is the difference between jdk, jre, and jvm?
What are thread safe functions?
Why transient variables wont participate in serialization?
What is JVM ?
4 Answers Phantom Technologies, TCS,
System.out.println("somestring"); It will create any object or not
What is string literal in java?
Why does java doesnot support multiple inheritance?
What is more advisable to create a thread, by implementing a Runnable interface or by extending Thread class?
Why declare Main() method as a static in java ?
Why scanner is used in java?
Why char array is favored over string for the storage of passwords?
why are wait(), notify() and notifyall() methods defined in the object class? : Java thread