Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes JSP and the fly likes How to include image in a JSP? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "How to include image in a JSP?" Watch "How to include image in a JSP?" New topic
Author

How to include image in a JSP?

Balaji Krishnan
Greenhorn

Joined: Dec 14, 2011
Posts: 13
I need to include images(car) in a jsp. This jsp file is used to list down the various cars. I am using <img src=""> to perform this. But all of these images won't be in same dimensions. How can i include these images dynamically without affecting screen design.

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56204
    
  13

You can control the size of the displayed images with CSS. Why can't you just make the images the right size in the first place?


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Balaji Krishnan
Greenhorn

Joined: Dec 14, 2011
Posts: 13
Thanks for your guidance. As i can't have control over the images, i would like to go with the CSS approach. Please clarify if i can still use CSS, if the uploaded contents are HTML files not images.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56204
    
  13

You can't show HTML with an <img> tag, so that's not going to work in any case.

Perhaps you should tell the whole story about what you are trying to accomplish. Otherwise, time is wasted guessing.
Balaji Krishnan
Greenhorn

Joined: Dec 14, 2011
Posts: 13
I need to show the uploaded content in a jsp. It could be either a image or html file. For html i will be using widget tag inside in the jsp, which will act as jsp:include at runtime for the html. And for image we can img src. But my concern is about the dimension of the uploaded file. How to handle these dynamic files in jsp?
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: How to include image in a JSP?
 
Similar Threads
Issue in including image in a html from another server
how to include struts action in jsp
JSP INCLUDE
context path in the message.properties of struts
dynamically including JSP's