Submit Your Article Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Code > JavaScript

Reply
 
LinkBack Thread Tools
Old November 13th, 2007, 02:59 PM   #1
New Member
 

Join Date: Oct 2007
Location: Holland
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 pesho318i is on a distinguished road
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:
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
pesho318i is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old November 13th, 2007, 10:33 PM   #2
Highly Reputable Member
 

Join Date: Sep 2007
Age: 17
Posts: 716
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 Stuart has a spectacular aura about Stuart has a spectacular aura about
Re: dynamically refreshing webpage content

I think it would be easiest to refresh the entire page. Like this:
HTML Code:
<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...
Stuart is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old November 14th, 2007, 09:28 AM   #3
New Member
 

Join Date: Oct 2007
Location: Holland
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 pesho318i is on a distinguished road
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.
pesho318i is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old November 14th, 2007, 05:51 PM   #4
Highly Reputable Member
 

Join Date: Sep 2007
Age: 17
Posts: 716
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 Stuart has a spectacular aura about Stuart has a spectacular aura about
Re: dynamically refreshing webpage content

That should work. Good luck, and if you have any problems, just ask...
Stuart is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 HTML, XHTML and CSS 7 March 13th, 2008 05:21 PM
Changing URL without refreshing page ? Perfection Studios JavaScript 4 September 14th, 2006 08:22 AM
refreshing webpages! zillah_dee HTML, XHTML and CSS 2 June 8th, 2006 02:48 PM
Problem with Screen Refreshing Stumpy_uk JavaScript 1 January 10th, 2006 03:57 AM
Refreshing new changes... Tim356 HTML, XHTML and CSS 2 May 14th, 2005 09:21 PM


Search Engine Optimization by vBSEO 3.2.0 RC8