Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Applet or servlet

Reply
Thread Tools

Applet or servlet

 
 
fasisi
Guest
Posts: n/a
 
      02-11-2008
Hello,

I have a website and I want, for example, the background image
dynamically change every week. I will have the images on the hosting
server. Should I use applet or servlet?


Thank you,

Fasisi

NB: Is there good source to learn servlet other than Sun's tutorial?
 
Reply With Quote
 
 
 
 
Andrea Francia
Guest
Posts: n/a
 
      02-11-2008
I can't use an applet to doing this.
You can use any server side technologies that change the content sent
over the time, such as jsp, servlet, or even PHP.
Or you can use a client side technology (such as javascript) to request
a different background image each week.
Or you can simply use an automated ftp client that replaces the
background image every week.

I think the last mentioned solutions is the simplest one, but if you
want solve the problem in order to learning something about java you can
try to realize a solution based on servlets.

I'm not able to recommend any book to you, may be you can find something
useful in the O'reilly books.

fasisi wrote:
> Hello,
>
> I have a website and I want, for example, the background image
> dynamically change every week. I will have the images on the hosting
> server. Should I use applet or servlet?
>
>
> Thank you,
>
> Fasisi
>
> NB: Is there good source to learn servlet other than Sun's tutorial?


 
Reply With Quote
 
 
 
 
GArlington
Guest
Posts: n/a
 
      02-11-2008
On Feb 11, 6:28 am, fasisi <Frans.Indroy...@gmail.com> wrote:
> Hello,
>
> I have a website and I want, for example, the background image
> dynamically change every week. I will have the images on the hosting
> server. Should I use applet or servlet?
>
> Thank you,
>
> Fasisi
>
> NB: Is there good source to learn servlet other than Sun's tutorial?


If you want to change the background image as seldom as once a
week(month/day) you can set a scheduled job which will change your web
servers rewrite rule for your background image.
If you want it done more often (on rotation basis) you are better of
using some sort of server side script to generate the image (or image
name) dynamically...
 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      02-11-2008
On Sun, 10 Feb 2008 22:28:33 -0800 (PST), fasisi
<> wrote, quoted or indirectly quoted someone
who said :

>I have a website and I want, for example, the background image
>dynamically change every week. I will have the images on the hosting
>server. Should I use applet or servlet?


You don't need either. Just change the file locally and upload. That
is how I change the critter of the day on page
http://mindprod.com/index.html

Most people handle that with a Servlet. I handle it with static
macros.
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      02-11-2008
On Mon, 11 Feb 2008 03:11:16 -0800 (PST), GArlington
<> wrote, quoted or indirectly quoted someone
who said :

>On Feb 11, 6:28 am, fasisi <Frans.Indroy...@gmail.com> wrote:
>> Hello,
>>
>> I have a website and I want, for example, the background image
>> dynamically change every week. I will have the images on the hosting
>> server. Should I use applet or servlet?
>>
>> Thank you,
>>
>> Fasisi
>>
>> NB: Is there good source to learn servlet other than Sun's tutorial?

>
>If you want to change the background image as seldom as once a
>week(month/day) you can set a scheduled job which will change your web
>servers rewrite rule for your background image.
>If you want it done more often (on rotation basis) you are better of
>using some sort of server side script to generate the image (or image
>name) dynamically...


see http://mindprod.com/jgloss/pseudorandom.html

For how to get an integer you can use to select the image.

You can xor in the name of the page (as hashCode), or today's date, as
time divided by millis per day as the seed to make the selection
depend on date or page, not changing every time.

Here is the guts of one of my static macros that selects a daily quote
for each page:

/**
* expand Quotation macro guts
*
* @param fileBeingProcessed file where macros are embedded.
*
* @return on of the choice strings, randomly chosen
*/
private String expand( File fileBeingProcessed )
{
// use today as a seed so will generate same value for
24-hours
// using GMT elapsedTime. Flip will happen at midnight GMT or
4 PM PST.
// Reproducible every time we run this macro that day.
// Xor in hashCode of filename to give a different quote to
different pages.
final Random wheel =
new Random( fileBeingProcessed.getPath().hashCode()
^ ( System.currentTimeMillis() / ( 24
* 60
* 60
* 1000
) ) );
final String chosenQuote = QUOTATIONS[ wheel.nextInt(
QUOTATIONS.length ) ];

return "<blockquote>"
+ chosenQuote
+ "</blockquote>";
}
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
 
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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
applet to applet - servlet model Tedy Java 1 08-04-2005 11:08 AM
Offending class: javax/servlet/Servlet.class chamikara Java 1 06-19-2004 05:42 AM
Servlet question(Tomcat, web.xml, servlet-class, servlet-name) circuit_breaker Java 2 04-04-2004 03:26 AM
Tomcat: POST from one servlet or internal class to another servlet Sean Clarke Java 1 01-07-2004 02:22 PM
how to get my servlet configuration before the servlet is initialised Andy Fish Java 4 12-17-2003 09:47 PM



Advertisments
 



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 44 45 46 47 48 49 50 51 52 53 54 55 56 57