Can we use servlets in JavaScript?

Answer Posted / balu

we cant use servlets in javascript but we can call a
servlet by retrieving the form and setting the action as
the url.
ex:if our html has a from named 'XXX'

var formName = document.getElementById('XXX');
var url = contextPath + '/desiredServlet';
formName.action = url;
formName.submit();

Is This Answer Correct ?    7 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What exactly is a servlet?

714


What is a servlet context object?

872


What are the objects involved when a servlet receives a call from client?

758


What is api in servlet?

752


How we can call a jsp from the servlet?

722


Is servlet a server side scripting language?

814


Which application server is best for java?

772


What is the difference between Servlets and Applets?

756


I Have A Plan to develop a Project in Struts,I want the template of struts project with Hibernate.Canany body provide me the required information?

2454


Differentiate between the print writer and servlet output stream?

752


List out the difference between ServletConfig and ServletContext?

790


How does Cookies work in Servlets?

886


What are the life cycle methods of a servlet?

780


What are all the protocols supported by httpservlet?

863


What is httpservlet class?

757