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


Please Help Members By Posting Answers For Below Questions

What are adapter classes?

793


What sorting algorithm does javascript use?

759


What is the purpose of a default constructor?

835


What are the differences between forwarding () method and sendredirect() methods?

836


What is n in java?

738


What is meant by javabeans?

823


How do I stop concurrentmodificationexception?

739


Which programming language is most secure?

741


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

1629


What are recursive functions?

801


What is annotation in java?

791


What is the function of http?

766


What is jee6?

752


Which class cannot be a subclass in java?

731


State the main difference between c++ and java?

801