الانتقال إلى المحتوى
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.

Upload Image From Mysql In Adf

Featured Replies

بتاريخ:

السلام عليكم

دي السيرفلت اللي انا عملتها ورابطها مع الصوره في خانة ال source ب /displayimage?compid=#{bindings.CompId.inputValue} ولكن مش بيظهرلي الصوره في المتصفح 

 

 

package view;

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

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import javax.naming.Context;
import javax.naming.InitialContext;

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

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

    

    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType(CONTENT_TYPE);
        String imageId = request.getParameter("compid");
        OutputStream os = response.getOutputStream();
        Connection conn = null;
        String imgLen = "";
        try {
            Context ctx = new InitialContext();
            conn = getMySQLConnection();
            PreparedStatement statement =
                conn.prepareStatement("SELECT comp_logo FROM company WHERE comp_id = '" + imageId + "'");
            ResultSet rs = statement.executeQuery();

            if (rs.next()) {
                //imgLen = rs.getString(1);
               // int len = imgLen.length();
                byte[] rb = rs.getBytes(1);
                //InputStream readImg = rs.getBinaryStream(1);
               // int index = readImg.read(rb, 0, len);
                response.reset();
                response.setContentType("image/png");
                response.getOutputStream().write(rb);
                response.getOutputStream().flush();
                //response.getOutputStream().close();

            }
        } catch (Exception e) {
            System.out.println(e);
        } finally {
            try {
                if (conn != null) {
                    conn.close();
                }
            } catch (SQLException sqle) {
                System.out.println("SQLException error");
            }
        }
    }
    public static Connection getMySQLConnection() throws Exception {
        String driver = "com.mysql.jdbc.Driver";
        String url = "jdbc:mysql://localhost:3306/publicsales";
        String username = "****";
        String password = "******";

        Class.forName(driver);
        Connection conn = DriverManager.getConnection(url, username, password);
        return conn;
    }
}
 

تم تعديل بواسطة tolba hamdi_133096

بتاريخ:

هل تم إرجاع بيانات؟

بتاريخ:
  • كاتب الموضوع

هل تم إرجاع بيانات؟

نعم تم ارجاع بيانات ولكن الصوره لم ترجع

بتاريخ:

يبدو الكود صحيحاً

جرب تثبيت القيمة

بتاريخ:
  • كاتب الموضوع

يبدو الكود صحيحاً

جرب تثبيت القيمة

تم حل المشكله

الخطأ كان عند عمل السيرفلت كان ال checkbox علي  annotation وليس configuriation flie (web.xml)

 

ولكن انا عندي استفسار اخر

هذا الكود بيتم عرض الصوره من الداتا بيز وانا اعلم الكود لعرض الصوره من ملف عن طريق مسار الصوره ولكن السؤال هنا ازاي اخلي ال image component ياخد المصدر بتاعه من الداتا بيز عند التنقل بين البيانات او ياخد المصدر بتاعه لما اجي اعمل createinsert واختار الصوره من ملف

بتاريخ:

اربط الصورة بالمسار وهذا كافي

بتاريخ:
  • كاتب الموضوع

كيف اربط الصوره بالمسار اللي اختاره المستخدم من خلال ال  input file component بدون عمل ابلود للصوره علي السيرفر يعني مجرد ما يعمل بروز للصوره يتم عرضها في ال image component

بتاريخ:

لا بد من انتقالها إلى السيرفر

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

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

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

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

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

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.