Dear JSP  gurus,

Using JSP, I am displaying images using a 1-d array of image nos. into a
webpage.The array
actually consists of only the image nos.(without the extn.), corresponding
to the image file names in a directory.
In the JSP, I am using the following  piece of code to display the images.

<%!
        int row;
        String[] rowData;

        String  getRowData( int row )
        {
                return ( "" + rowData[row] + ".jpg" );
        }
%>

    ****  I am then assigning an array of image nos.(without the extn.) from
a servlet to this rowData[] in JSP.****

**** Then for displaying the images , I am using the following piece of
code( given below in brief)****

<%    for ( row=0; row< rowData.length; row++ )
    {
%>
        <img src = "<%= getRowData(row) %>" >
<%
      }
%>

Now, the problem is that the extn. of image is not const.
It can be .jpg  or  .gif  or  .jpeg
So, I need to check the extn. of each image . which I am calling from this
directory, & accordingly assign the extn. in the getRowData(row)  method  at
runtime.
I don't have the slightest idea as to how to check the image ext. from the
directory for the image that I am calling.

Could anybody pl. help?
Any help will be greatly appreciated.

Sunil K. Roy

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to