Sunil-
A JSP tag scriptlet tag *can* be nested inside an html tag since the
scriptlet tags get resolved at compile time, then the html tag becomes <img
source = 1.jpg > or whatever (btw, you might want to enclose your image file
name in quotes). Your problem is that the array name you use in your loop
is intImg instead of imgNo.
-katherine
-----Original Message-----
From: Sunil Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 02, 2000 3:10 PM
To: [EMAIL PROTECTED]
Subject: JSP ( Runtime access of filenames of images in JSP )
Dear JSP gurus,
Pl. solve my following problem:
Pl. see the following code for displaying images "1.jpg" , "2.jpg" , "3.jpg"
, etc. in
subsequent <td> in the same row:
<%@ page import = "ImageServlet" %>
<html>
<body>
<%! int imgNo[];
int col;
%>
<!-- staticImgNo is a static int array in the servlet ImageServlet -->
<% imgNo = ImageServlet.staticImgNo ; %>
<table><tr>
<%
for ( col = 0 ; col < imgNo.length ; col++ )
{
%>
<td>
<!-- I wish to display the various images with the for loop.
But I know that the following statement in invalid since the JSP tag
can't be nested inside an html tag. But I wish to know the
alternative
method of displaying the various images
-->
<img src = <%= "" + intImg[col] + ".jpg" %> >
</td>
<%
}
%>
</table>
</body>
</html>
Thanks in anticipation
Eagerly waiting for a reply.
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
===========================================================================
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