Altanai
Altanai

Reputation: 1393

reload a part of JSP page without refreshing the whole page

I am working on combination of jsp and servlets. I have to reload a specific part of jsp page ( maybe table, div or section ) when servlet updates the value in db, without refreshing the entire page.

I am not a pro jQuery user, but can understand it as beginner.

Upvotes: 2

Views: 8065

Answers (2)

Grim
Grim

Reputation: 1974

Give your table, div or section an id (aaa in example) and try this:

<script src="http://code.jquery.com/jquery-latest.js"></script>
<button onclick="jQuery('#aaa').load(' #aaa');">Reload</button>
<div id="aaa"><%=new java.util.Date().toString()%></div>

Upvotes: 6

Hariharan
Hariharan

Reputation: 3263

You can use Ajax, which browser will support default as simple too.

You can also use DWR(Direct Web Remoting), but it require to add some additional configuration in web.xml and add jar.

Upvotes: 1

Related Questions