What I'm trying to do is probably very simple, but for some reason I'm drawing a complete blank on how to do it.
I am working on a web site that uses JSP / Servlets using Tomcat.
I have an image folder and let's say there are 5 images named photo1, photo2 ... photo5.
All I want to do is randomly display a different photo each time the page draws.
In Java, I understand how to use the File class and how to make things Random. I am pretty new at JSP, so I'm not sure if there's something there I can use.
The part that I'm stuck on, is how to structure the directory path so the File object can read the image directory inside the web server. (I've tried using a URI object, but have had no luck.)
Or, I don't mind dropping the whole File idea, if there's a better solution.
Thanks!
I am working on a web site that uses JSP / Servlets using Tomcat.
I have an image folder and let's say there are 5 images named photo1, photo2 ... photo5.
All I want to do is randomly display a different photo each time the page draws.
In Java, I understand how to use the File class and how to make things Random. I am pretty new at JSP, so I'm not sure if there's something there I can use.
The part that I'm stuck on, is how to structure the directory path so the File object can read the image directory inside the web server. (I've tried using a URI object, but have had no luck.)
Or, I don't mind dropping the whole File idea, if there's a better solution.
Thanks!