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 do you mean by deployment descriptor?

767


Explain how to improve Servlet Performance?

845


How to generate the server side programming and the advantages of it over the other languages?

795


What are the ways to handle multi-threading in servlets?

852


Tell us something about servletconfig interface.

784


Explain session tracking and its importance?

755


Can we fetch the attributes related to a servlet on a different servlet?

898


Should I override the service() method?

881


What is session tracking?

918


What do you understand by mime type?

805


What is servlet initializer?

717


How can we create deadlock situation in servlet?

1089


Why is it that we can't give relative URL's when using ServletContext.getRequestDispatcher() when we can use the same while calling ServletRequest.getRequestDispatcher()?

865


Whether thread can be used in servlets?

964


How do you create a cookie using servlet?

864