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

Explain their methods? Tell me their parameter names also have you used threads in servlet?

584


Explain the difference between generic servlet and http servlet?

541


When should you prefer to use doget() over dopost()?

661


What is httpservlet and how it is different from genericservlet?

609


Why do we have servlet filters?

603






What is servlet mapping?

603


What are the difference between session and cookies in servlet? Explain

565


request parameter how to find whether a parameter exists in the request object?

575


How we can create war file in servlet?

663


How can you create a session in servlet?

596


Why are servlets used?

534


What are the functions of Servlet container?

609


What if you need to span your transaction across multiple servlet invocations?

582


What are the various ways of session supervision in servlets?

525


What are the types of servlet?

669