Dynamic Photo Album using JSP

Hi all,
I've been having a bit of trouble getting help with my question - I've tried a couple of usenet groups, however don't seem to be asking the right question. So, I'm hoping that some Java forums may be of more relevance. I'm sorry if this is the wrong place, and if there is a better place for me to ask my question if you could tell me where that is, I'ld be greatful.
I am looking at finding/ making an online dynamic photo album which
uses JSP. I've seen a lot of examples using PHP and a few online
albums using Javascript, however those albums using JavaScript are not
dynamic - the images are hard coded.
My scenario is this, we have about 6 different events with about 150
photos each. What I would like to happen is to be able to have a index
page which lists 10 photos each, and when you click on the photo to be
taken to a secondary page with a larger image. I would like to do this
without needing to create 150 dependant pages.
I understand that we will be looking at using server side technology.
As our pages already use JSP we don't want to add a second server side
language (PHP, Pearl etc...) to the equation.
So does anyone know of a script that may already do this? As I seem to be having no luck in finding one to suit my purpose, I would be happy to create my own script.
The problem is that I am not too familiar with JSP - though I used to do a fair bit of ASP using VB Script. What I would like is to be pointed into a page that will show me how to create an array with a list of filenames in a given directory (using a Site relative path). From there I should be right, but I can't seem to find any references to how this can be done using JSP (or even Javascript).
If anyone can help me I would greatly appreciate it.
Regards
Linda

You need to File class, it can produce a list of files in a directory.
File photodir = new File("c:/path/to/photos");
File[] photos = photodir.listFiles();
for(int i = 0; i < photos.length; i++){
File fp = photos;
if(fp.isFile()){
// check to see if it is an image

Similar Messages

  • Dynamic photo album

    Hello.
    I am trying to create a dynamic photo album.
    private var xmlString:URLRequest;
    private var xmlLoader:URLLoader;
    private var index:int;
    private var pages:Array;
    private function init():void {
    xmlString = new URLRequest("gallery.xml");
    xmlLoader = new URLLoader(xmlString);
    index = 2;
    pages = new Array();
    xmlLoader.addEventListener(Event.COMPLETE, initData);
    private function initData(event:Event):void {
    var albumsXML:XML = XML(xmlLoader.data);
    var entries:XMLListCollection = new
    XMLListCollection(albumsXML.children());
    for (var i:int = 0; i < entries.length; i++) {
    var albumName:String =
    entries.getItemAt(i).attribute("location");
    //trace("album name: " + albumName);
    var imagesEntry:XMLListCollection = new
    XMLListCollection(entries.getItemAt(i).children());
    for (var j:int = 0; j < imagesEntry.length; j++) {
    var imageSource:String =
    imagesEntry.getItemAt(j).attribute("source");
    //trace("image source: " + imageSource);
    addPage(albumName+imageSource, index++);
    private function addPage(imageSource:String, index:int):void
    var page:PortratePage = new PortratePage();
    page.addEventListener(FlexEvent.CREATION_COMPLETE,
    onPageCreated);
    var pageAttributes:ArrayCollection = new ArrayCollection();
    pageAttributes.addItem(imageSource);
    pageAttributes.addItem(index);
    pages[page] = pageAttributes;
    trace(pages[page] + "," + pages.length);
    private function onPageCreated (event:FlexEvent):void {
    //do stuff
    XML data is loaded just fine and the addPage function gets
    called.
    In it, I initialize a new page (external PortratePage.mxml),
    but the handling onPageCreated function is never called.
    I was told that initializing mxml instances is done
    asynchronously, that's why I need to define a CREATION_COMPLETE
    event but for some reason it does not work.
    Anyone has any idea why?
    BTW: is there a way to make external mxml objects
    initialization to be synchronously?
    Thanks
    Sefi

    FlexEvent.CREATION_COMPLETE might not be dispatched unless
    PortratePage is somehow a decendant of UIComponent. Or maybe you
    could define your own event in PortratePage and dispatch it at the
    right time.

  • I tried to implement photo albums using iweb and got a publishing error.

    I tried to implement photo albums using iweb and got a publishing error. All was fine with my site until I added the photo album page. The software doesnt say what the error is exactly, only that it is a publishing error to my ftp
    Exact message "There was an error communicating with the FTP server. Try again later, or check with your service provider."
    If I reduce the albums inside to 1 then it seems to work but that takes away from the usefullness of multiple albums.
    my iWeb version is 3.0.4 (601)

    Publish your site to a folder on your hard drive to see if the publication will proceed successfully and open the site locally with your browser to confirm all of the alums are there and work.  If they do try the following:
    delete the iWeb preference files, com.apple.iWeb.plist and com.apple.iWeb.plist.lockfile, that resides in your Home() /Library/Preferences folder.
    go to your Home()/Library/Caches/com.apple.iWeb folder and delete its contents.
    Click to view full size
    launch iWeb and try again.
    If you're still not able to publish from iWeb to your server download and use the free  Cyberduck to upload your website files to the server. Users have found that CD has been successful when iWeb had problems.
    OT

  • DYNAMIC TABLE CREATION USING JSP

    I WANT TO CREATE A DATABASE TABLE IN AN INTERACTIVE WAY ie MY QUESTION IS: HOW TO CREATE A TABLE USING JSP WITH TWO ARRAYS(FIRST ARRAY CONTAINS FIELD(COLUMN) NAMES AND THE SECOND ARRAY CONTAINS ITS CORRESPONDING DATATYPE)BOTH ARRAYS ARE OF VARYING SIZE.IF THE USER ENTERS SUPPOSE '6' AS THE INPUT TO FORM A TABLE OF 6 FIELDS SO, THE QUERY SHOULD BE DYNAMICALLY FORME USING THE ARRAY NAME FOR FIELD AND THE ARRANAME FOR ITS CORRESPONDING DATATYPE.HAVE ANY IDEA ON THIS PLEASE LET ME KNOW.
    THANKS

    u need to know quite a few java technologies to make archieve your dream.
    JDBC, dynamic array and JSP.
    after reading tutorial regarding to these 3 materials, you should be able to get your job done.

  • Dynamic Tree Creation using JSP, Struts framework

    I urgently require tips/information/code snippet for creating a Dynamic Tree structure.
    Tree is the hierarchical folder structure that we see in windows operating system.
    Dynamic tree in the sense that all nodes shall be populated from database & a radio button shall be present at each node that can be selected & submitted to form.
    Tree should be done using JSP (& if required Javascript).
    I am using Struts framework .
    [email protected]

    u need to know quite a few java technologies to make archieve your dream.
    JDBC, dynamic array and JSP.
    after reading tutorial regarding to these 3 materials, you should be able to get your job done.

  • When I down load photo albums using i tunes from my computer to my ipad2, the download knocks out or erases the prior picture album.  Can you help me to be able to down load multiple albums.  I keep my photos in Picasa on my windows computer

    When I down load photo albums from my computer to my i pad using i tunes, it erases my prior album.  My picture are stored in Picasa.  Can you help me download multiple albums without losing any of them.  Thank you.

    Photos that you sync from your computer can't be deleted directly in the iPad's Photos app, instead they are deleted by not including them in the next photo sync - so you need to include all the albums that you want to be on your iPad in each photo sync, what you are effectively currently doing is telling iTunes to replace the last synced album with the new one.

  • My photo albums used to be sorted by name now they are sorted by date (ipod touch ) any ideas?

    my photo albums on my ipod touch
    were sorted by name now they are sorted by date taken .I didn't change any settings on my computer any ideas?

    You're in the Photo Mode with Event Titles displayed so you are looking at events.  But in this mode you can only sort the photos within the Events, not the Events.
    Go to the Events mode and there you can sort the events by: date, title or manually:
    FWIW albums arew those items in the left hand pane:
    OT

  • Dynamic Photo Gallery in Flash using AS3.0 and XML, but it doesn't work and missed up my app.

    Hi,
    I am creating an iPad app using AS3. The app contains three sections.
    One of those sections (chocolate sources)contains Dynamic Photo Gallery using XML. The photos, thumbnails, and text in this section are loaded from XML.
    I faced may issue when I tried to run this app:
    The gallery photos didn't show up
    The thumbnails (buttons to navigate the photo gallery) didn't show up at all. (The thumbnails should show up under the photo gallery box.)
    The text doesn't show up (the text should be in every photo as describtion)
    I want to include Swipe in the photo gallery, how can I do that?
    When I click on "Chocolate Sources" button, the photo gallery appears in every section, here are print screens describe what I mean:
    The photo gallery covers the home screen too.
    Here is my XML:
    <?xml version="1.0" encoding="utf-8"?>
    <sources>
              <section>
                        <details>
                                            Cocoa tree exists in the tropics area, such as Central and South America.
                                  </details>
                                            <image>
                                                      <url>coca1.jpg</url>
                                                      </image>
                                                      </section>
              <section>
                        <details>
                        Cocoa is supplied in many countries such as Indonesia, Ghana, Brazil, Ecuador and Cameroon.
                        </details>
                                  <image>
                                  <url>coca2.jpg</url>
                                  </image>
                                            </section>
              <section>
                                  <details>
                                  Dark chocolate helps to relax and reduce the stress and blood pressure because it has antioxidants elements, which helps in vasodilatory process.
                                  </details>
                                            <image>
                                            <url>coca3.jpg</url>
                                                      </image>
                                                                </section>
              <section>
                        <details>
                        Chocolate provides energy and hyperactive sometimes because it contains high level of caffeine and sugar.
                        </details>
                                  <image>
                                  <url>coca4.jpg</url>
                                            </image>
                                                      </section>
              <section>
                        <details>
                        Chocolate could be mixed with many different flavors, such as mint, strawberry, orange, banana, vanilla, hazelnut, almond, coconut, and etc.
                        </details>
                                  <image>
                                  <url>coca5.jpg</url>
                                  </image>
                                            </section>
              <section>
                        <details>
                                  Chocolate is expressing of well hospitality and good time due to its lovely taste.
                                  </details>
                                            <image>
                                            <url>coca6.jpg</url>
                                                      </image>
                                                                </section>
    </sources>
    And here is my Action Script for "Chocolate Sources" section:
    stop();
    function Choco1(evt:MouseEvent): void {
              gotoAndStop('16');
    choco_btn.addEventListener(MouseEvent.CLICK,Choco1);
    function Souc1 (evt:MouseEvent): void {
              gotoAndStop ('31');
    souc_btn.addEventListener(MouseEvent.CLICK,Souc1);
    function ShopIn1 (evt:MouseEvent):void {
              gotoAndStop('46');
    shops_btn.addEventListener(MouseEvent.CLICK,ShopIn1);
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    import flash.events.Event;
    import flash.display.MovieClip;
    import flash.display.Loader;
    import fl.motion.MotionEvent;
    import flash.events.MouseEvent;
    import flash.sampler.NewObjectSample;
    import flash.text.TextFormat;
    var xmlLoader: URLLoader = new URLLoader (new URLRequest("sources.xml"));
    xmlLoader.addEventListener(Event.COMPLETE, finishedXmlLoader);
    var xmlFile:XML;
    var xextend:int = 10;
    var gal:galary = new galary ();
              gal.x = 85;
              gal.y = 165;
              addChild(gal);
    var txfe: TextField = new TextField ();
    txfe.x = 25;
    txfe.y = 45;
    var tformat:TextFormat = new TextFormat ();
    tformat.bold = true;
    tformat.color = 0xFFFFFF;
    tformat.size = "18";
    tformat.font = "Arial";
    txfe.defaultTextFormat = tformat;
    addChild(txfe);
    function finishedXmlLoader (e:Event): void{
              xmlFile = new XML (xmlLoader.data);
              var leng:int = xmlFile.image.length();
              txfe.text = xmlFile.image.details[0];
              for (var i:int = 0;i<leng;i++){
                        var b:thumbs = new thumbs ();
                        b.x = xextend;
                        b.y = 480;
                        b.buttonMode = true;
                        b.details = (i+1).toString();
                        addChild(b);
                        b.addEventListener(MouseEvent.MOUSE_OVER, theMosover);
                        b.addEventListener(MouseEvent.MOUSE_OUT, theMosout);
                        b.addEventListener(MouseEvent.CLICK, onMosClick);
                        var bloader:Loader = new Loader();
                        bloader.load(new URLRequest("thumbs/" + (i+1) + ".jpg"));
                        b.addChild(bloader);
                        xextend += b.width + 50;
    var loader:Loader = new Loader ();
    loader.load(new URLRequest ("pictures/coca1.jpg"));
    gal.addChild(loader);
    function theMosover(m:MotionEvent):void{
              m.currentTarget.alpha = 0.5;
    function theMosout (m:MouseEvent):void{
              m.currentTarget.alpha = 1.0;
    function onMosClick(m:MouseEvent):void{
              var loader:Loader = new Loader();
              loader.load(new URLRequest("pictures/" + m.currentTarget.details + ".jpg"));
              gal.addChild(loader);
              txfe.text = xmlFile.image.details[int(m.currentTarget.details) -1];
    I need an urgent help to fix the errors and make this section work well.
    thanks.

    try:
    txfe.text = xmlFile.section[int(m.currentTarget.details) -1].details;
    instead of
    txfe.text = xmlFile.image.[int(m.currentTarget.details) -1];
    and add your thumbs to gal, not the stage.  when you're done with the gallery, remove gal.

  • Using TabbedPanels widget to make photo album

    I was pondering upon a nice tutorial here at Adobe - really good, but it used Dreamweaver 8 (while being written at CS3 era) and a lot of efforts to be done by hands - about the ways to create a photo album using built-in Dreamweaver CS4 Spгy features.
    Probably i'm not the first one who came up with the idea like this - to use vertical Tabbed Panels widget, where tabs serve as holders for thumbnails, and panels content the bigger images. Still needs some polishing and measures corrections to be made, but the main thing is that it's simple and it works!
    So, any ideas, advices?

    Oh! i see...
    Such a pity that Dreamweaver still has got no simple instrument (or some third-party freeware extention)  to build nice and modern-looking (and working) photo-albums with the gallery of thumbnails - you have to manually generate XML database of all your images, which is a tedious task, like in that aforementioned tutorial...
    Or is there?
    thank you for the reply, V1!

  • Dynamic photo gallery in flex

    superb post for a Dynamic photo gallery using a xml generated flex application http://flexlearner.wordpress.com/2009/09/04/dynamic-photo-gallery-in-flex/

    try:
    txfe.text = xmlFile.section[int(m.currentTarget.details) -1].details;
    instead of
    txfe.text = xmlFile.image.[int(m.currentTarget.details) -1];
    and add your thumbs to gal, not the stage.  when you're done with the gallery, remove gal.

  • Creating a Photo Album In Dreamweaver MX 2004

    I followed the steps to create a web photo album using
    Dreamweaver MX 2004 and Fireworks and it creates it. However, I
    can't get it to display on the web when I upload it. It displays
    the message "Page can not be found". Please help!

    I think the fact that you have spaces in your files/folder
    names is bound to
    have created problems. I suggest you do some renaming and
    re-upload.
    BTW it is incredibly difficult to access pages on the site.
    If Alan hadn't
    put the link in I would have given up.
    Jo
    "Alan" <[email protected]> wrote in
    message
    news:C0D03CEE.295268%[email protected]..
    >
    >
    >> Ithe link is on my Events page. you can get to it by
    entering the site
    >> and
    >> clicking the events link.
    >
    >
    http://www.arelevantministry.com/photo%20album/index.htm
    >
    > have you selected and PUT all the files?
    >
    > find "photo%20album" folder, select and Put it.
    > do all the files transfer?
    >
    >
    >

  • How do I create multiple photo albums?

    I was curious as to how I can create multiple photo albums using only the iPhone 4. I found out a way to creat "one" album. But I can't even change the name of it and it's not very useful if I can only create one album. I have a lot of pictures on my phone and I would like to sort them out. I use Windows 7 not a Mac. (Wish I had one though)
    Also, will the iOS 5 allow users to create photo albums using only the phone? The current OS doesn't seem to allow it.
    Thanks for your time!

    I should have fiddled with my computer more. I figured it out by creating a "Master" folder. And inside that folder contains more folders with my organized pictures. But, would still like to be able to do this all on the phone. That would make the iPhone just THAT much more simple.

  • How to add a photo album

    how can i add a photo album using contribute? And what photo
    album software can i use?

    how can i add a photo album using contribute? And what photo
    album software can i use?

  • Web Photo Album

    I have successfully created photo albums using the DW menu
    command and FW. I don't like the formatting of the thumbnail table
    and the resulting individual photo pages. Is it possible to edit
    the template that is used to create the 2 pages so that future
    photo albums will use it? I don't really want to be forced to
    manually edit each page. It kind of defeats the purpose of being
    able to create the album in the first place.

    Thanks, I figured it out later by just playing with it. I
    appreciate your response.

  • How do you sort photo albums in date order instead of alphabetic order?

    My photo albums used to be date sorted but after selecting Sort albums, they are now in alphabetic order. How do I undo that, please?

    [quote]
    Dear Grumpy
    this is strictly a user to user forum and is specifically NOT a place to contact Apple  - griping at the volenteer users here does no one any good at all
    Have you made the request - iPhoto menu ==> provide iPhoto feedback?
    LN
    [/quote]
    I am sorry that I ran afoul of the user guidelines, I'll remove the rant if I can.  I certainly did not intend my  gripe to target the helpful responder.  And yes, I did provide the feedback to Apple.  I'm just used to such feedback going into a "black hole".  Which this almost certainly does because this problem has existed for years (I Googled for an answer first.)  However, it should be noted that company's tend to respond to feedback that is very public if they want to keep a good name in the business.  The private feedback through the program is like a quiet whisper, only the two parties involved know about it, so there is no real incentive for prompt action.
    DLC

Maybe you are looking for