الانتقال إلى المحتوى
View in the app

A better way to browse. Learn more.

مجموعة مستخدمي أوراكل العربية

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Show Blob Column

Featured Replies

بتاريخ:

how to make icon in show detail item in accordion panel read from blob Column in data base

بتاريخ:

هذا يعتمد على نوع الملف الأصلي ، هل هو صورة أو PDF أو ماذا بالضبط؟

بتاريخ:

1- inset inside the show detail  inlineFrame

2- set the source of the inline frame to a managed bean String  attribute

              <af:inlineFrame id="if1" source="#{myBean.frameSource}" shortDesc="Document Viewer"
                                    styleClass="AFStretchWidth" inlineStyle="height:600px;"
                                   "/>

3- CREATE A SERVLET that display the file

example :

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;

import javax.servlet.*;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;

import oracle.jbo.ApplicationModule;
import oracle.jbo.Row;
import oracle.jbo.client.Configuration;
import oracle.jbo.domain.BlobDomain;
import oracle.jbo.server.ViewObjectImpl;

@WebServlet(name = "ShowFileServlet", urlPatterns = { "/showFile/*" })
public class ShowFileServlet extends HttpServlet {
    private static final String CONTENT_TYPE = "text/html; charset=UTF-8";

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

    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String amDef = "org.dhaman.dms.model.services.DmsAppModule";
        String config = "DmsAppModuleLocal";
        ApplicationModule am = Configuration.createRootApplicationModule(amDef, config);
        String recordId = request.getParameter("id");
        String contentTypeFile = request.getParameter("contentType");      
        if(contentTypeFile ==null){
            ViewObjectImpl vo =
                (ViewObjectImpl) am.findViewObject("DocumentInfoVo");
            vo.setNamedWhereClauseParam("p_id", recordId);
            vo.executeQuery();
            Row row = vo.first();
            String conType = (String) row.getAttribute("ContentType");
            contentTypeFile=conType;            
        }
        String contentType = contentTypeFile + ";charset=windows-1256";
        response.setContentType(contentType);
        OutputStream os = response.getOutputStream();      
        ViewObjectImpl vo =
            (ViewObjectImpl) am.findViewObject("DocumentInfoVo"); // get view object (the same as used in the table)
        vo.setNamedWhereClauseParam("p_id", recordId);
        vo.executeQuery();
        Row product = vo.first();
        BlobDomain image = (BlobDomain) product.getAttribute("DocFile");
        InputStream is = image.getInputStream();
        // copy blob to output
        byte[] buffer = new byte[10 * 1024];
        int nread;
        while ((nread = is.read(buffer)) != -1) {        
            os.write(buffer, 0, nread);        
        }
        os.close();
        Configuration.releaseRootApplicationModule(am, true);       
    }

    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType(CONTENT_TYPE);
        PrintWriter out = response.getWriter();
        out.println("<html>");
        out.println("<head><title>ShowFileServlet</title></head>");
        out.println("<body>");
        out.println("<p>The servlet has received a POST. This is the reply.</p>");
        out.println("</body></html>");
        out.close();
    }
}

note that the servlet name is "/showFile" and it takes two parameters : 

id : the record primary key

contentType : the document type for example  "text/html" , "image/tiff", "application/pdf"  - for more information search in google  about  mime-type

 

4- in your page add a discloseListener to the showDetailItem

5- in the code of the discloseListener  , set the source to the inline frame . for example

        DCIteratorBinding docIterator = getIterator("YouIteratorName");
        Row row = docIterator.getCurrentRow();
        if (row != null) {
            DBSequence id = (DBSequence) row.getAttribute("Id");
            String contentType = (String) row.getAttribute("ContentType");
            String recid = id.toString();
            setFrameSource("/showFile?id=" + recid + "&contentType=" + contentType);
        }
بتاريخ:
  • كاتب الموضوع

شكرا لك اخي طارق فتحي على هذا المثال الموضح

وانت ايضا مصطفى ماجد شكرا لك على اهتمامك

بتاريخ:
tarek_fathi

لو كان نوع الملف غير معروف فلن تعمل هذه الطريقة

بتاريخ:

tarek_fathi

لو كان نوع الملف غير معروف فلن تعمل هذه الطريقة

 

هيحصلة داون لود

ال validation  بيحصل اثناء عمل upload فمثلا ممكن ارفض الملفات الغريبة او التنفيذية 

بتاريخ:
tarek_fathi

كلامك صحيح ولكن طالما نتكلم عن blob فيمكن أن يكون به أي نوع من أنواع الملفات خاصة لو كان يستخدم في أرشفة ملفات

بتاريخ:

هل تقصد ان ممكن نعمل preview لكل نوع ملف بدل ما نستخدم InLine Frame

يعنى مثلا لو الملف نوعه PDF  يبقى نعمل pdf viewer   

و لو excel  يبقى نعمل excel viewer    و هكذا

ولا نعرض اى ملف من خلال ال browser و فى الحالة دي فى ملفات هتتعرض ذى ال pdf  مثلا و فى ملفات هيحصلها download  ذى الاكسيل مثلا

هل فى افكار تانية غير دي؟

بتاريخ:

هذا ممكن

انضم إلى المناقشة

يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.

زائر
أضف رد على هذا الموضوع...

برجاء الإنتباه

بإستخدامك للموقع فأنت تتعهد بالموافقة على هذه البنود: سياسة الخصوصية

Account

Navigation

البحث

إعداد إشعارات المتصفح الفورية

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.