بتاريخ: 19 أبريل 201411 سنة comment_249444 how to make icon in show detail item in accordion panel read from blob Column in data base تقديم بلاغ
بتاريخ: 19 أبريل 201411 سنة comment_249458 هذا يعتمد على نوع الملف الأصلي ، هل هو صورة أو PDF أو ماذا بالضبط؟ تقديم بلاغ
بتاريخ: 20 أبريل 201411 سنة comment_249476 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); } تقديم بلاغ
بتاريخ: 21 أبريل 201411 سنة كاتب الموضوع comment_249492 شكرا لك اخي طارق فتحي على هذا المثال الموضح وانت ايضا مصطفى ماجد شكرا لك على اهتمامك تقديم بلاغ
بتاريخ: 21 أبريل 201411 سنة comment_249505 tarek_fathiلو كان نوع الملف غير معروف فلن تعمل هذه الطريقة تقديم بلاغ
بتاريخ: 21 أبريل 201411 سنة comment_249513 tarek_fathi لو كان نوع الملف غير معروف فلن تعمل هذه الطريقة هيحصلة داون لود ال validation بيحصل اثناء عمل upload فمثلا ممكن ارفض الملفات الغريبة او التنفيذية تقديم بلاغ
بتاريخ: 21 أبريل 201411 سنة comment_249516 tarek_fathiكلامك صحيح ولكن طالما نتكلم عن blob فيمكن أن يكون به أي نوع من أنواع الملفات خاصة لو كان يستخدم في أرشفة ملفات تقديم بلاغ
بتاريخ: 22 أبريل 201411 سنة comment_249524 هل تقصد ان ممكن نعمل preview لكل نوع ملف بدل ما نستخدم InLine Frame يعنى مثلا لو الملف نوعه PDF يبقى نعمل pdf viewer و لو excel يبقى نعمل excel viewer و هكذا ولا نعرض اى ملف من خلال ال browser و فى الحالة دي فى ملفات هتتعرض ذى ال pdf مثلا و فى ملفات هيحصلها download ذى الاكسيل مثلا هل فى افكار تانية غير دي؟ تقديم بلاغ
انضم إلى المناقشة
يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.