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

عمل صفحة Jsp وربطها بالاوراكل

Featured Replies

بتاريخ:

السلام عليكم الاخوة الاعضاء انا مبتدئ في برمجة الjsp ولقلة المصادر في هذا الموضوع احببت ان اشارك بموضوع بسيط وهو عمل صفحة jsp وربطها بالاوراكل وعمل استعلام بواسطة الرقم وعرض النتائج في جدول اولا انشئ جدول في الاوراكل وسميه employ وفيه الحقول EMP_ID,EMP_NAME,EMP_ADD
ثانيا نقوم بانشاء صفحة الjsp افتح النود باد
نقوم باستيراد مكتبة الاتصال ومكتبة الادخال والاخراج

<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>

نقوم بتعريق ثلاثة متغيرات الاول لاجرا الاتصال هو connection والثاني لتنفيذ الاستعلام وهو statement والثالث لعرض النتائج هو rs , التعريف يكون كالتالي


<%!
Connection connection = null;
Statement statement = null;
ResultSet rs = null;
%>


نفتح صفحة الhtml

<html>
<head>
<title>display data from the table using jsp</title>
</head>
<body bgcolor="blue">

نقوم بعمل الاتصال


<%
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
connection = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","MYUSER","MYUSER");
out.print("connected");
%>

<%
}
catch (Exception ex)
{
%>
<font size="+3" color="red"></b>
<%
out.println("Unable to connect to database.");
}
%>

لشرح الاتصال بقواعد البيانات في هذا الرابط http://www.araboug.org/ib/index.php?showtopic=2274

نقوم باضافة زر الاتصال وحقل الاستعلام

<p align=center><form action="conect.jsp" metho="get">
<input type="submit" value="Query">
<input type="text" name="qr">
</form></p>



نقوم بعمل الاستعلام وعرضه في جدول


<%
try
{
statement = connection.createStatement();
String QueryString = "SELECT * from employ where EMP_ID='"+request.getParameter("qr")+"'";

rs = statement.executeQuery(QueryString);

}
catch(Exception es)
{
out.print("error");
}
%>

<p align=center><table border=1>
<tr>
<td><h1> emp_id </h1></td>
<td><h1> emp_name </h1></td>
<td><h1> emp_address </h1></td>
</tr>
<%
while(rs.next())
{
%>
<tr>
<td><h1><%= rs.getInt(1)%><h1></td>
<td><h1><%= rs.getString(2)%><h1></td>
<td><h1><%= rs.getString(3)%><h1></td>
</tr>
</table></p>

<%
}
%>

نقوم بقفل اhtml

</body>
</html>

قم بحفظ الصفحة با conect.jsp

اعذروني لانه مش شرح بالتفصيل ولكن الكود والصفحة في المرفقات

تم تعديل بواسطة mohamed shabarga

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

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

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

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

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

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.