This discussion is archived
0 Replies Latest reply: Dec 6, 2011 10:05 AM by 866724 RSS

OrdHttpResponseHandler problem [screens]

866724 Newbie
Currently Being Moderated
Hello,

So, i have following java code which was written in JSP :
<%@page import="oracle.ord.im.OrdHttpJspResponseHandler"%>
<%@page import="oracle.ord.im.OrdHttpResponseHandler"%>
<%@page import="oracle.ord.im.OrdImage"%>
<%@page import="oracle.jdbc.OracleResultSet"%>
<%@page import="java.sql.PreparedStatement"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="OracleConn.OracleConnection" %>

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Biblioteka muzyczna</title>
        <link rel="stylesheet" type="text/css" href="css/style.css"/>
    </head>
    <body>
        <h1>IMAGE :</h1>
        <br/><br/>
        <%
            OracleConnection conn = new OracleConnection();
            try {
                String query = "select plikimage from testimage where id=2";
                PreparedStatement pstmt = conn.polaczzBaza().prepareStatement(query);
                OracleResultSet rset2 = (OracleResultSet) pstmt.executeQuery();
                if (rset2.next()) {
                    OrdImage imgProxy = (OrdImage) rset2.getORAData("plikimage", OrdImage.getORADataFactory());

                    OrdHttpResponseHandler handler = new OrdHttpResponseHandler(request, response);
                    handler.sendResponse(imgProxy.getMimeType(), imgProxy.getContentLength(), imgProxy.getContent(), imgProxy.getUpdateTime());
                    
                    //Next solution below
                    //OrdHttpJspResponseHandler handler2 = new OrdHttpJspResponseHandler();
                    //handler2.sendImage(imgProxy);
                } else {
                    response.setStatus(response.SC_NOT_FOUND);
                }

            } catch (Exception e) {
            }


        %>
    </body>
</html>
So, code works i mean it shows only the image which was loaded from database. I would like to change code in this way, that i would able to add some other stuff to the website.

Screen :

http://imageshack.us/photo/my-images/834/screenwn.png/

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points