Hi folks,
This is a pretty general question and I hope I am in the appropraite forum.
In HTML one can display an image with the following code:
<img src="path/image.jpg" width = "70" height="100" />
Now, if I want to display an image in a
jsp and then use some logic to redisplay a second image in the same location on the page, how do I do it? The above is hard coded. In a jsp I cannot build a
string and then display it, i.e.
<% String i1 = "path/image1.jpg";
String i2 = "path/image2.jpg";
.. some logic to assign either i1 or i2 to s..
String h = "<img src=" + s + "width=/""70" ... etc;
%>
as you see, although I have built a String, the HTML bit is still text. I can't think of a way of parameterising the HTML. I thought of actually writing different images into the file located at
path/image.jpg
but this feels wrong, since in web apps generally, writing to the deployed files is not usually recommended.
So, how does one display different images on a page?
with best regards,
Simon Ingram