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

Bc, Ejb & Jsf Login Form Using Database Concept

Featured Replies

بتاريخ:

Dear All



this is Example i made for all people here to Login Form Using DB User Concept with Dynamic any number of Screens & Users, i used BC,EJB & JSF Languages

First BC Customized Scripts
public String GetURL(String Name) {
String URL = "-1";
getMyTables1().setWhereClause("name like '" + Name + "'" +
" AND active = 'Y'");
try {
getMyTables1().executeQuery();
} catch (JboException e) {
throw new JboException(e.getMessage());
}
if (getMyTables1().getRowCount() > 0) {
while (getMyTables1().hasNext()) {
Row TableRow = getMyTables1().next();
URL = (String)TableRow.getAttribute("Url");
}
} else {
URL = "-1";
}
return URL;
}

public void CheckUserForms(String User, int Size) {
getAllUserForms2().setMaxFetchSize(Size);
getAllUserForms2().defineNamedWhereClauseParam("UName", null, null);
getAllUserForms2().setNamedWhereClauseParam("UName", null);
getAllUserForms2().setNamedWhereClauseParam("UName", User);

try {
getAllUserForms2().executeQuery();

} catch (JboException e) {
throw new JboException(e.getMessage());
}

}

public String UserNamePassword(String User, String Password) {
String FinalResult = "0";
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
Connection conn = null;
try {
conn =
DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE", User,
Password);
} catch (SQLException e) {
FinalResult = "0";
}
try {
if (conn.isValid(20) == true) {
FinalResult = "1";
} else {
FinalResult = "0";
}
} catch (SQLException e) {
FinalResult = "0";
}
return FinalResult;
}

public void NewCreateInsert() {
Row NewRow = getAllUserForms().createRow();
getAllUserForms().insertRow(NewRow);
}

public void afterConnect() {
getAllUserForms2().setMaxFetchSize(0);
getAllUserForms2().executeQuery();
}

public void list(String NamePar) {
if (NamePar == null){
System.out.println("No Need to write code here, just for interface");
}

Second EJB Customized Scripts

public BindingContainer getBindings() {
return BindingContext.getCurrent().getCurrentBindingsEntry();
}

public String Login() throws SQLException {
BindingContainer bindings = getBindings();
String Final = null;
// Checking user Name & Password
Object error = "Please Enter a Valid User Name, Password & Access. ";
if (getIt1().getValue() != null && getIt2().getValue() != null &&
getIt3().getValue() != null) {
OperationBinding operationBinding0 =
bindings.getOperationBinding("UserNamePassword");
operationBinding0.getParamsMap().put("User", getIt1().getValue());
operationBinding0.getParamsMap().put("Password",
getIt2().getValue());

Object result0 = operationBinding0.execute();
if (!operationBinding0.getErrors().isEmpty() ||
result0.toString() == "0") {
getAot1().setValue(error.toString());
} else {
// Fetting URL
OperationBinding operationBinding =
bindings.getOperationBinding("GetURL");

operationBinding.getParamsMap().put("Name",
getIt3().getValue());
Object result = operationBinding.execute();
System.out.println(getSoc1().getValue());
if (!operationBinding.getErrors().isEmpty()) {
Final = null;
getAot1().setValue(null);
getIt1().setValue(null);
getIt2().setValue(null);
getSoc1().setValue(null);
}
getSoc1().setValue(null);
if (result != null) {
Final = result.toString();
}
}
} else {
if (getIt1().getValue() == null) {
Alert(it1, "Login Error", "Please, Enter Valid User Name");
}
if (getIt2().getValue() == null) {
Alert(it2, "Login Error", "Please, Enter Valid User Password");
}
}
return Final;
}

public void Alert(UIComponent MyComponent, String ErrorHeader,
String ErrorDetail) {
FacesContext facescontext = FacesContext.getCurrentInstance();
if (MyComponent != null) {
FacesMessage MyMessage =
new FacesMessage(FacesMessage.SEVERITY_ERROR, ErrorHeader,
ErrorDetail);
facescontext.addMessage(MyComponent.getClientId(facescontext),
MyMessage);
((RichInputText)MyComponent).setValue(null);
((RichInputText)MyComponent).setRequired(true);
((RichInputText)MyComponent).setValid(false);
}
}


public void Password_validator(FacesContext facesContext,
UIComponent uIComponent, Object object) {
if (object == null) {
((RichInputText)uIComponent).setRequired(true);
((RichInputText)uIComponent).setValid(false);
}
}


public void User_validator(FacesContext facesContext,
UIComponent uIComponent, Object object) {
if (object != null) {
System.out.println(object.toString().toUpperCase());
BindingContainer bindings = getBindings();
OperationBinding operationBinding0 =
bindings.getOperationBinding("CheckUserForms");
operationBinding0.getParamsMap().put("User",
object.toString().toUpperCase());
operationBinding0.getParamsMap().put("Size", 100);
Object result0 = operationBinding0.execute();
if (!operationBinding0.getErrors().isEmpty()) {
Alert(uIComponent, "Validation Error",
"Please, Enter Valid User Name");
}
} else {
((RichInputText)uIComponent).setRequired(true);
((RichInputText)uIComponent).setValid(false);
}
getIt2().setValue(null);
}

Print Screens
Screen1
Screen2
Screen3
Screen4
Screen5
Screen6

Full Project
Login


Attached, Print Screens , Full Source Code , My Test DB Script

Many Thanks

  • بعد 5 سنة...
بتاريخ:

سلام عليكم باش مهندس .....جزاك الله خيرا على هذا العمل

ولكن الروابط لاتعمل .... الرجاء اعادة ارسال الروابط ان امكن ذلك

ولكم جزيل الشكر

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

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

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

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

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

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.