Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dynamic content in HTML Pages

 
Prabhakar Rao
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How the sites are displaying Dynamic content in HTML pages.
Suppose if we take index.html of rediff, each time you refresh the page it shows a different ad.

Please explain the topic in deatil.

Thanks in advance
-Prabhakar
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could be using some simple Javascript.
 
Prabhakar Rao
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for that

But I need the actual process on
-how they put space for the dynamic content.
-how they display dynamic content each time.
Will be thankful if you can provide some code demonstration.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They may not be static HTML pages either.
Most server side technologies provide a way to map url strings to dynamic content. Something like "mypage.html" could actually be pointing to a PHP page or Cold Fusion app.
 
sven studde
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Prabhakar Rao:
How the sites are displaying Dynamic content in HTML pages.
Suppose if we take index.html of rediff, each time you refresh the page it shows a different ad.

What does "of rediff" mean?

I agree with Bear and Ben. Displaying a different ad on a page everytime the page is loaded can be accomplished on the client side with simple javascript or it can be accomplished on the server side using a server side language like php or servlets + jsp.

But I need the actual process on
-how they put space for the dynamic content.

It sounds like you might need to learn some html as well. Web browsers render html in the order it appears on the page (although that order can be altered using css). Also, you can use css to make text on a web page flow around any sized image automatically, so the size of the image would be irrelevant.

-how they display dynamic content each time.

You populate an array with different .jpg files that are ads. When the request is received, you program the jsp or servlet to generate a random integer and assign it to a variable. You use that variable as the index value of the array, e.g.

myAds[myRanNum]

and then you assign that specific .jpg file to the src attribute of an <img> tag, e.g.

out.println("<h1>My Web Page</h1>");
out.println("<img src=\"http://mysite.com/someDir/ads/" + myAds[myRanNum] + "\"/>");
out.println("<div>some text here</div>");

[ October 05, 2006: Message edited by: sven studde ]
 
Kartik Patel
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another way of creating dynamic html is through XML/XSLT.
You create an dynamic XML and parse it through XSLT toi generate html page.
the page will have dynamic data and its still an html page.
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you mean to change the content and add some functionality after a HTML has been rendered , then you might use javascript.Using AJAX you can even send HTTPXMLRequest to server and manupulate the response data at the client side using javascript.Is that you want ?
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic