hello everybody
i am newbie to jsp.
working on some project and struck into some problem.
my poject is about web rendering .
i am creating a buffer image and storing that in to some file .when i am trying to open this file on browser using jsp,it is not showing me the actual image.
my code was working fine with 1e6.it started creating probs in ie8.
if i zoom my image on browser,it is not zooming it but the image that is there in file is responding correctly.
thanx in advance for any
help

Recommended Answers

All 11 Replies

plz help me out .i am very new to jsp

You been asked by number of our members to also include any relevant coding. This is missing and without it there is little hope somebody will attempt to help you...

in my jsp i am storing the buffered image in to somefile

<%
BufferedImage image = (BufferedImage)session.getAttribute("image");
String path = application.getRealPath("/");
String imagePath = path+"images//mapimage.jpeg";
File file =new File(imagePath);
ImageIO.write(image,"jpeg",file);
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>MapMaker</title>
<script type="text/javascript">

var image1;
var x1;
var y1; 
var isDragging=false;
var dx;
var dy;
var x2;
var y2;
var x;
var y;
var ob;

window.onload = init;
document.onmousemove = mM;
document.onmouseup = mU;

function init() 
{
	ob = document.getElementById("image1");	
}

function mD(ob,e) //on mouse down event
{
	image1 = ob;
	
	if (window.event) e=window.event;	
	
	x1 = e.clientX;
	y1 = e.clientY;
	isDragging = true;
	
	return false;
}

function mM(e) //mouse move
{
	if (!isDragging) return;
	
	if (window.event) e=window.event;
	x2 = e.clientX;
	y2 = e.clientY;
	
	
	return false;
}

function mU() //mouse up
{   
	if (!isDragging) return;
	
	isDragging = false;
	dx = x1-x2;
	dy = y1-y2;
	document.displayMapForm.dx.value = dx;
    document.displayMapForm.dy.value = dy;
        
    if(isNaN(dx) && isNaN(dy))
    {
    	return false;
    }   
	else
	{						
 		document.displayMapForm.submit();
 	}	
}

function move()//displays coordinates as mouse moves on image
{
	window.status = " X = " + event.x + " Y = " + event.y 
}

</script>

</head>
<body onmousemove="move();"
<img id="image1" src="/image/mapimage.jpeg"  align="left" width="1500" height="1500" onmousedown="mD(this, event)" ></img>
 </body>
</html>

i am also using struts famework in this

commented: 3 different threads asking the same thing -1

the same code was working fine in ie6.
but now when i started using 1e8,mozilla,its creating problems.

With little modification now, your code is working.

BufferedImage image = (BufferedImage)session.getAttribute("image");
   String path = application.getRealPath("/");
   String imagePath = path+"images//mapimage.jpeg";
   File file =new File(imagePath);
   FileOutputStream fos=new FileOutputStream(file);
   ImageIO.write(image,"jpg",fos);
   fos.flush();
   fos.close();

If you don't get an answer soon don't start another thread asking the same thing. What did you expect? That the very first minute you posted everyone should give you the solution? Your impatience was very annoying, flooding the forum with new threads.
We are not here to serve your needs nor we are obligated to give you immediately the answer.
If you didn't get a reply then wait for someone who knows the answer to post. Posting and posting again will not change things.

Threads merged

Threads merged

Finally, Good job

thanx everyone for helping me.finally i reached at the solution.

thanx a lot for ur help.i am new to jsp.so lz dont mind if i ask some stupid questions.
thanx a gain .
bye

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.