Thursday 16 November 2017

How to call a servlet in the js??

At times we come across a requirement where we have to call a servlet in our js file. This can be achieved as shown below::

var value;
$.get('/bin/testservlet', function(data) {console.log('test',data);
                                                    value=data});

/bin/testservlet= This is the path property set in the servlet. The request looks for the servlet that has this path property set.

data=contains the response sent back from the servlet. The response returned can then be used for the needed logic.

In this example the get method is executed.

No comments:

Post a Comment

extraClientlibs Usage

The purpose of property "extraClientlibs" is to selectively load client library for a dialog. This prevents the unnecessary load o...