i am sorry i did not deliver my question in a proper way. what i actually meant was...I want a specific part of my code in a jsp page to be executed based on a given time automatically. Like the refresh option in the jsp page..but the refresh option refreshes the whole page but i just want a prt of the code in the page to be executed or refreshed every 2 or 3 secs..
JSP is a server side technology, which means that if you want to refresh the page you will have to perform a request to the server which will return the new page. It is not possible to just return part of a page through normal JSP mechanisms.
i think ajax is easy for refresh part of the code.
I think probably that you are using the word "code" wrong.
JSPs are primarily HTML templates designed to present a View to a client. There should not be a lot of executable code in the JSP. That's an obsolete and very hard-to-debug practice. Instead, the JSP should primarily be markdown language (HTML).
However, a popular thing to do these days is to do a partial page update for a client, where instead of replacing the currently-displayed page image (HTML) with a whole new one, you keep the majority of the currently-displayed client-side page and simply update parts of it. And you do that using AJAX.
That's my best guess on what you really want. If you can describe an abstract example of what you are expecting to see happen from the client viewpoint, we can probably offer more specific details.
Loudly announcing something is true and finding out you're wrong makes you feel foolish.
Finding out you're wrong and refusing to admit it makes you LOOK foolish.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop