jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From far4ever <fathimafarh...@gmail.com>
Subject displaying the image using JSP
Date Mon, 01 Dec 2008 07:05:10 GMT

i have extracted the image from the repository ( as Inputstram) in a servlet
and now i need to pass it to the JSP and make it display but with some other
text fields as well . but when i use my below code it displays the object
but not the text... and also it throws a exception as well ( when 'forward'
of dispatcher is called) 

servlet code

InputStream pic = null;
        try {
            OutputStream os = null;
            try {
                pic = profileImgManageBean.viewImage("fileName");

                int read = 0;
                byte[] bytes = new byte[1024];
                os = response.getOutputStream();
                while ((read = pic.read(bytes)) != -1) {
                    os.write(bytes, 0, read);
            } catch (ImageNotFoundException imE) {

            RequestDispatcher view =
            view.forward(request, response);

        } catch (Exception ex) {
null, ex);
        } finally {


JSP code
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>User Prifile Picture</title>
        <h2>Profile Picture</h2>
         <%=response.encodeURL(request.getContextPath())%   BORDER=0

can anyone say the proper way to diaplay the image( also i need to know for
other documents as well e. g pdf..) please help.....
View this message in context: http://www.nabble.com/displaying-the-image-using-JSP-tp20766990p20766990.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

View raw message