0 Replies Latest reply: Mar 4, 2013 12:46 AM by saeed zamani RSS

    Show images in human task forms

    saeed zamani
      Dear all,
      I try to show a blobdomain picture in Ui form,
      when i use a normal adf project, i use a servlet as below

      public class showDocument1 extends HttpServlet {
      private static final String CONTENT_TYPE = "imag/gif; charset=utf-8";

      public void init(ServletConfig config) throws ServletException {
      super.init(config);
      }

      public void doGet(HttpServletRequest request,
      HttpServletResponse response) throws ServletException,
      IOException {


      response.setContentType(CONTENT_TYPE);
      String imageId = request.getParameter("id");
      OutputStream os = response.getOutputStream();
      Connection conn = null;
      try {
      Context ctx = new InitialContext();
      conn = getOracleConnection();
      PreparedStatement statement =
      conn.prepareStatement("SELECT RCDC_RQRO_RQST_RQID,Imag " +
      "FROM sas_imag_document " +
      "WHERE RCDC_RQRO_RQST_RQID = ?");

      statement.setInt(1, new Integer(imageId));
      ResultSet rs = statement.executeQuery();

      if (rs.next()) {
      Blob blob = rs.getBlob("Imag");
      BufferedInputStream in = new BufferedInputStream(blob.getBinaryStream());
      int b;
      byte[] buffer = new byte[10240];
      while ((b = in.read(buffer, 0, 10240)) != -1) {
      os.write(buffer, 0, b);
      }
      os.close();
      }
      } catch (Exception e) {
      System.out.println("error="+e.getMessage());
      } finally {
      try {
      if (conn != null) {
      conn.close();
      }
      } catch (SQLException sqle) {
      System.out.println("SQLException error");
      }
      }
      }


      and the connection is something like this:



      public static Connection getOracleConnection() throws Exception {
      String driver = "oracle.jdbc.driver.OracleDriver";
      String url = "jdbc:oracle:thin:@192.168.1.31:1521:backup";
      String username = "test";
      String password = "test";
      return conn;
      }
      and it works.
      but in bpm applications it seems that the connection is not available for the project and the picture does not appear in the form.
      i think that i should use a jdbc data source like the one that i use for ma business components.
      can anybody help m whit this problem?

      Thank you very much indeed.