Thak you for ur reply.
But in Servlet-Chaining concept, one servlet output stream passed to another servlet and goes on...
like that, is possible to do same in jsp.
My actual task is to send the image from one jsp page to another, the sample code i paste here
<%@ page import="java.io.*" autoFlush="true" %>
<%
System.out.println("======Send.jsp=====");
ServletContext sercon = getServletContext();
String filename = sercon.getRealPath("/logo.png");
RequestDispatcher rd = sercon.getRequestDispatcher ( "/read.jsp" ) ;
InputStream file=new BufferedInputStream(new FileInputStream(filename));
int i,j=0;
try
{
OutputStream os=response.getOutputStream();
while((i=file.read())!=-1)
{
j++;
os.write((byte)i);
}
System.out.println("Bytes Read : "+j);
rd.forward(request,response);
os.flush();
file.close();
}
catch(Exception e)
{
System.out.println("Error"+j);
}
%>
<%@ page import="javax.swing.*,java.io.*,java.util.*"%>
<%
byte[] by;
int i,j=0;
System.out.println("======Read.jsp=====");
response.setContentType("image/png");
InputStream is=request.getInputStream();
System.out.println("In Read.jsp read bytes : "+is.available());
ByteArrayOutputStream os=new ByteArrayOutputStream();
while((i=is.read())!=-1)
{
j++;
os.write(i);
}
by=os.toByteArray();
out.println(by+"\n"+i);
os.close();
is.close();
%>
If i run this code (send.jsp) the image is displayed in the current page itself, and not forward to read.jsp
Is any other alternative solutions then point out.