wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes img tag in jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "img tag in jsp" Watch "img tag in jsp" New topic
Author

img tag in jsp

jagdish waran
Greenhorn

Joined: Mar 31, 2008
Posts: 6
iam trying to display an image from the local system on the browser using image tag, in my jsp file. But the image is not displayed. i am using netbeans6.0 IDE and tomcat 6.0.14 for development.

below is the code . it is a simple html code. iam unable to trace the error.
anuone please help me out of this.

<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script>
function getimgsize()
{
var path=document.getElementById('f1').value;
alert(path);
document.write("<img src='"+path+"'>")
}
</script>

</head>
<body>
<img src="D://jagdish//images//five.jpg" alt="image cannot be displayed"/>
<form method="post" action="" onsubmit="getimgsize()">
<input type="file" name="file1" id="f1">
<input type="submit">
</form>
</body>
</html>


Thanks in advance,
jagdish
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60800
    
  65

You do realize that this will work only when the browser is being displayed on the system housing the image file and will not work on any other system, right?

In any case, what's with the double-slashes?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: img tag in jsp
 
Similar Threads
Display jpeg file in jsp page
JSP and HTML Frames
Display of Latin Characters
request.getParameter in IE
Doing auto-submit while displaying animated gif