dynamically refreshing webpage content

This is a discussion on "dynamically refreshing webpage content" within the JavaScript Forum section. This forum, and the thread "dynamically refreshing webpage content are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Nov 13th, 2007, 18:59
Junior Member
Join Date: Oct 2007
Location: Holland
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
dynamically refreshing webpage content

hi guys

(obviously) I have a problem I'll try to explain it as clearly as I can. If I sound confusing somewhere, please don't hesitate to ask me for clarificaiton.

My webpage consists of different sectors. Each one is a separate JSP page.

When I want to refresh a single sector, I use a javascript function, which issues a request to the controller servlet and the servlet returns the appropriate JSP page along with a Java object, containing information used in the JSP. The servlet code is something of the sort:

Code: Select all
MyCar aCar = new MyCar();
// Set attributes
request.setAttribute("aCar", aCar);

// Forward to the appropriate JSP
if (p.getServerInfo().getPageType().equals("advertisement"))
{             getServletContext().getRequestDispatcher("/advertisement.jsp").forward(request, response);
} else if(......) {
       ...... forward to another JSP
}
then in the JavaScript function I plug the response of the servlet into the appropriate place (<div>) in my webpage.
However, sometimes I need to change more than one <div> based on the information that I pass with the Java object sent by the servlet.

A simple example: looking at the current(webforumz) page, let's say that the division on the right is advertisement.jsp. (As far as I understand) when I want to refresh it, I send a request to the servlet and it forwards the response to the advertisement.jsp and the result can be plugged from the JavaScript function into <div id=advertisement>
BUT let's say I also want to change the <div id=welcome>Welcome, Pesho318i</div> with another content, which I also can get from the Java object that the servlet sends as a request.
So, Ze question is how do I do that ???


Thank you in advance!
Pesho
Reply With Quote

  #2 (permalink)  
Old Nov 14th, 2007, 02:33
Highly Reputable Member
Join Date: Sep 2007
Age: 15
Posts: 717
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: dynamically refreshing webpage content

I think it would be easiest to refresh the entire page. Like this:
HTML: Select all
<meta http-equiv="refresh" content="0">
Set '0' to the number of seconds you want the page to wait before refreshing itself...
If this is not what you want, could you clarify.
If anyone else has a suggestion or thinks my suggestion is deprecated, don't hesitate to post...
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)
Reply With Quote
  #3 (permalink)  
Old Nov 14th, 2007, 13:28
Junior Member
Join Date: Oct 2007
Location: Holland
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Re: dynamically refreshing webpage content

thanks, but a full page refresh is not what I want. To solve the problem I will probably use two Ajax requests from my JavaScript function...

P.
Reply With Quote
  #4 (permalink)  
Old Nov 14th, 2007, 21:51
Highly Reputable Member
Join Date: Sep 2007
Age: 15
Posts: 717
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: dynamically refreshing webpage content

That should work. Good luck, and if you have any problems, just ask...
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Solved] Web Site is Refreshing Too Much spyke927 Web Page Design 7 Mar 13th, 2008 20:21
Changing URL without refreshing page ? Perfection Studios JavaScript Forum 4 Sep 14th, 2006 12:22
refreshing webpages! zillah_dee Web Page Design 2 Jun 8th, 2006 18:48
Problem with Screen Refreshing Stumpy_uk JavaScript Forum 1 Jan 10th, 2006 07:57
Refreshing new changes... Tim356 Web Page Design 2 May 15th, 2005 01:21


All times are GMT. The time now is 22:28.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43