• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

without reloading the page

 
surendar prabu
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my servlet provides a response to the client with some form fields having default values.when i want to change the default value of a particular field based on some selection over other field or some request........what is the way to achieve this?

I want to do this with out reloading the whole page ,as i want to reduce traffic in my server. Can i use servlet filters for this?
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know much about servlet filters, but I don't think they are going to help you with your problem.

To update parts of a Web page, without doing a full refresh, you can use JavaScript to modify the HTML Document Object Model (DOM). This runs on the client, not the server, so does not cause any load on your server.

If the update requires some information that can only be supplied by the server, you can get that information, without a full refresh. The modern approach is to send an XmlHttpRequest to the server. The XmlHttpRequest calls back to some JavaScript when it has got the data from the server. Alternative approaches use IFRAMEs; you can make your IFRAMEs visible or invisible (zero-sized).
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
surendar prabu,
Welcome to JavaRanch!

In an effort to help you get the most from our forums, we've compiled a
list of tips for asking questions here. You can find the list in our
FAQ section here.
In particular, please see UseAMeaningfulSubjectLine.

"without reloading the page" is not a very good summary of your question.

Again, welcome to JavaRanch and good luck with your question.
-Ben
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65217
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by surendar prabu:

I want to do this with out reloading the whole page ,as i want to reduce traffic in my server. Can i use servlet filters for this?


Why would you think that servlet filters have anything to do with this?

If you want to grab information from the server without a page reload, then Ajax is the technology you'll need to use. But that won't really eliminate traffic to the server -- a request/response cycle will still take place (though it will reduce the amount of data transferred: typically, Ajax requests return small snippets of data rather than whole pages).

If you want to elminate any server traffic for this, you'll just need to preload any data that you might need to use on the page into JavaScript data structures.
 
Ajay Krishnamurthy
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi surendar,
Without reloading a page you want to get the values from some back end like (Database). For this process you have to use the AJAX.Using java script you can call the AJAX servlet through the Xmlhttp:// request.

Please refer some AJAX Tutorials you can acheive wat exactly you want .. ( I Think the java people provides lots of tutorial for AJAX) .

Regards
Ajay Krishnamurthy
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic