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
What are adapter classes?
What sorting algorithm does javascript use?
What is the purpose of a default constructor?
What are the differences between forwarding () method and sendredirect() methods?
What is n in java?
What is meant by javabeans?
How do I stop concurrentmodificationexception?
Which programming language is most secure?
Where can i get Latest SUN Certification Dumps and what are the Sun Certification Codes that are available, Im new to JAVA, so please gimme info as i need to write J2EE - Core Java Certification
What are recursive functions?
What is annotation in java?
What is the function of http?
What is jee6?
Which class cannot be a subclass in java?
State the main difference between c++ and java?