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
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: 8
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 opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50693

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: 8
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 opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50693

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: 8
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?
 
 
subject: How to include image in a JSP?
 
Threads others viewed
how to include struts action in jsp
Issue in including image in a html from another server
context path in the message.properties of struts
dynamically including JSP's
JSP INCLUDE
IntelliJ Java IDE