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 web applications?

618


What is servlet api used for conneting database?

688


Explain load on start-up and its importance?

590


Can you send an authentication error from a servlet?

511


What are the features added in Servlet 2.5?

760






Explain servlet events?

554


What is url encoding and url decoding

576


Explain the difference between generic servlet and http servlet?

537


How can you create a session in servlet?

585


What is servlet initializer?

497


Can we use the constructor, instead of init(), to initialize servlet?

574


What are the steps involved in placing a servlet within a package?

579


What is servlet attributes and their scope?

590


Which httpsession object is used to view and manipulate information about a session?

721


What are the types of an http request?

573