.load()jQuery与Servlet

Is it possible to load the contents in a div through a servlet via .load() jquery ?

I tried this

$('#getDetails').load('getDetails');

But its not working !! What can be an alternative to this ?

Thanks

Did you read the documentation? If there's one parameter, it must be a URL. getDetails alone apparently isn't.

got it.

I changed the method of servlet to do get, and passed a parameter with servlet name.

$('#getDetails').load('getDetails?process=u');

Its working now.

Thanks ..

Your servlet has to override method doGet, like this:

@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {

// implementation

}

In the web.xml, you put servlet mapping, like this:

<servlet>
    <servlet-name>MyServlet</servlet-name>
    <servlet-class>com.example.myservlet.MyServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>MyServlet</servlet-name>
    <url-pattern>/servlet</url-pattern>
  </servlet-mapping>
</servlet>

Then, you call servlet from JQuery context, like this:

function someFunction() {

    $("#yourDivId").load("./servlet");

}

Cheers!!