بتاريخ: 5 ديسمبر 20169 سنة comment_280454 السلام عليكم ورحمة الله وبركاته المطلوب طريقة ربط تنفيذ هذا ال ACTION بمتغير معين تقديم بلاغ
بتاريخ: 5 ديسمبر 20169 سنة comment_280455 في إعدادات هذا ال_ action تجد قائمة بالمعاملات والقيم التي تقوم بتعبئة المعاملات تقديم بلاغ
بتاريخ: 5 ديسمبر 20169 سنة كاتب الموضوع comment_280457 شكرا يا باشمهندس وضعت هذا الكود على الزرار disabled="#{backing_fin_year.update_Y!=1?'false':'true'}" وفى ال class bean private int Update_Y=0; ولكن يعطى الزرار دائما enable تقديم بلاغ
بتاريخ: 6 ديسمبر 20169 سنة كاتب الموضوع comment_280463 disabled="#{backing_fin_year.update_Y!=1?'true':'false'}" تم تعديل التاريخ1 بالفعل update_Y=1 ولكن الزرار لازال disable ولا يتأثر بتغير قيمة المتغير تقديم بلاغ
بتاريخ: 6 ديسمبر 20169 سنة كاتب الموضوع comment_280515 حضرتك تقصد القيمة #{backing_fin_year.update_Y!=1{ بحيث تبان true ام false ام المتغير update_Y تقديم بلاغ
بتاريخ: 7 ديسمبر 20169 سنة كاتب الموضوع comment_280522 تطبع فين ؟ واكتب ايه <af:link id="ot6" binding="#{backing_fin_year.ot6}" inlineStyle="background-color:Yellow; font-size:x-large; font-weight:bold;" text="#{backing_fin_year.userName}" disabled="#{backing_fin_year.update_Y!=1?'true':'false'}" action="*ExecuteParameter"> <af:setPropertyListener from="#{backing_fin_year.userName}" to="#{pageFlowScope.xxxx}" type="action"/> </af:link> تقديم بلاغ
بتاريخ: 7 ديسمبر 20169 سنة كاتب الموضوع comment_280523 تمام يا باشمهندس تقصد حضرتك اطبعه على الشاشة تقديم بلاغ
بتاريخ: 7 ديسمبر 20169 سنة كاتب الموضوع comment_280524 <af:outputText value="#{backing_fin_year.update_Y}" id="ot8" binding="#{backing_fin_year.ot8}"/> القيمة لم تتغير تعطى صفر على طول (الحالة disable) بالرغم فى ال java تتغير ل 1 وده كود الجافا import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; import javax.faces.application.FacesMessage; import javax.faces.context.FacesContext; import oracle.adf.model.BindingContext; import oracle.adf.model.binding.DCBindingContainer; import oracle.adf.model.binding.DCIteratorBinding; import oracle.jbo.domain.Date; import oracle.adf.view.rich.component.rich.RichDocument; import oracle.adf.view.rich.component.rich.RichForm; import oracle.adf.view.rich.component.rich.data.RichTable; import oracle.adf.view.rich.component.rich.fragment.RichPageTemplate; import oracle.adf.view.rich.component.rich.input.RichInputDate; import oracle.adf.view.rich.component.rich.input.RichInputText; import oracle.adf.view.rich.component.rich.nav.RichButton; import oracle.adf.view.rich.component.rich.nav.RichLink; import oracle.adf.view.rich.component.rich.output.RichMessages; import oracle.binding.OperationBinding; import oracle.jbo.domain.Number; import oracle.jbo.Row; import oracle.jdbc.driver.OracleDriver; import LOG_JD.ContollerBean.UserInfo; import oracle.adf.view.rich.component.rich.output.RichOutputText; import oracle.adf.view.rich.component.rich.output.RichSpacer; public class Fin_year { private String v_date_st ; private String v_message; private String c_date; private Date s_date; private Date v_date; private Date e_date; private Date f_date; private Number v_close; private RichOutputText ot8; private RichSpacer s1; private RichSpacer s2; public void setUpdate_Y(int update_Y) { this.update_Y = update_Y; } public int getUpdate_Y() { return update_Y; } private Number v_id; private Number USR_ID; private int update_Y=0; private RichPageTemplate pt1; private RichForm f1; private RichDocument d1; private RichMessages m1; private RichTable t1; private RichInputDate id1; private RichInputDate id2; private RichInputDate id3; private RichButton b1; private RichInputText it1; private RichInputDate id4; private RichLink ot6; UserInfo user = (UserInfo)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("userKey") ; String userName=user.getUserName(); int userid=user.getUserId().intValue(); public void setPt1(RichPageTemplate pt1) { this.pt1 = pt1; } public RichPageTemplate getPt1() { return pt1; } public void setF1(RichForm f1) { this.f1 = f1; } public RichForm getF1() { return f1; } public void setD1(RichDocument d1) { this.d1 = d1; } public RichDocument getD1() { return d1; } public void setM1(RichMessages m1) { this.m1 = m1; } public RichMessages getM1() { return m1; } public void setT1(RichTable t1) { this.t1 = t1; } public RichTable getT1() { return t1; } public void setId1(RichInputDate id1) { this.id1 = id1; } public RichInputDate getId1() { return id1; } public void setId2(RichInputDate id2) { this.id2 = id2; } public RichInputDate getId2() { return id2; } public void setId3(RichInputDate id3) { this.id3 = id3; } public RichInputDate getId3() { return id3; } public void setB1(RichButton b1) { this.b1 = b1; } public RichButton getB1() { return b1; } public void setIt1(RichInputText it1) { this.it1 = it1; } public RichInputText getIt1() { return it1; } public void setId4(RichInputDate id4) { this.id4 = id4; } public RichInputDate getId4() { return id4; } public void setV_date_st(String v_date_st) { this.v_date_st = v_date_st; } public String getV_date_st() { return v_date_st; } public void setV_message(String v_message) { this.v_message = v_message; } public String getV_message() { return v_message; } public void setC_date(String c_date) { this.c_date = c_date; } public String getC_date() { return c_date; } public void setDate(Date s_date) { this.s_date = s_date; } public Date getDate() { return s_date; } public void setV_date(Date v_date) { this.v_date = v_date; } public Date getV_date() { return v_date; } public void setE_date(Date e_date) { this.e_date = e_date; } public Date getE_date() { return e_date; } public void setF_date(Date f_date) { this.f_date = f_date; } public Date getF_date() { return f_date; } public void setV_close(Number v_close) { this.v_close = v_close; } public Number getV_close() { return v_close; } public void setV_id(Number v_id) { this.v_id = v_id; } public Number getV_id() { return v_id; } public void setUSR_ID(Number USR_ID) { this.USR_ID = USR_ID; } public Number getUSR_ID() { return USR_ID; } public void setUser(UserInfo user) { this.user = user; } public UserInfo getUser() { return user; } public void setUserName(String userName) { this.userName = userName; } public String getUserName() { return userName; } public void setUserid(int userid) { this.userid = userid; } public int getUserid() { return userid; } public String Fin_year_action() { // Add event code here... int result=1; update_Y=0; try { DateInfo date = null; System.out.println("qqqqqqqqqqqqqqqqqwwwwwwwwwwwwww"); DCBindingContainer dcbc = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry(); Row row =dcbc.findIteratorBinding("FinYearView1Iterator").getCurrentRow(); System.out.println("wwwwwwweeeeeeeeeeeee"); if (row!=null&&v_date!=null&&v_id !=null){ System.out.println("eeeeerrrrrrrrrrrrrrrr"); v_date_st=v_date.toString(); date = new DateInfo(); s_date =(Date)row.getAttribute("SysDate1"); date.setV_close_month(((Number)row.getAttribute("CloseMonth")).intValue()); date.setF_date((Date)row.getAttribute("StDate")); date.setE_date((Date)row.getAttribute("EndDate")); System.out.println("CDate"); System.out.println("CDate"+(String)row.getAttribute("CDate")); date.setC_date((String)row.getAttribute("CDate")); date.setV_date_idl(((Number)row.getAttribute("DateId")).intValue()); date.setDate((Date)v_date); Date dd=new Date(); System.out.println("sys_date "+v_date+"curr_date "+dd.getCurrentDate()+" "+c_date); int ii =(((Number)row.getAttribute("DateId"))).intValue(); System.out.println("rrrrrrrrrrr "+ii); System.out.println("uuuuuuuuu "+v_id.intValue()); if(v_id.intValue()!=ii){ result=0; System.out.println("خطأ رقم السنة المالية"+update_Y); FacesMessage message = new FacesMessage("خطأ رقم السنة المالية"); FacesContext.getCurrentInstance().addMessage(null, message); } if(v_date.compareTo(dd.getCurrentDate())>0) { result=0; FacesMessage message = new FacesMessage("خطأ تاريخ اكبر من تاريخ الجهاز"); FacesContext.getCurrentInstance().addMessage(null, message); } System.out.println("sys_date "+v_date+"curr_date "+dd.getCurrentDate()); if(v_date.compareTo(s_date)<0) { result=0; FacesMessage message = new FacesMessage("خطأ تاريخ اصغر من التاريخ الحالى"); FacesContext.getCurrentInstance().addMessage(null, message); } if(v_date.getValue().getMonth()!= s_date.getValue().getMonth()) { result=0; FacesMessage message = new FacesMessage("خطأ غير مسموح بتغيير الشهر"); FacesContext.getCurrentInstance().addMessage(null, message); } System.out.println("sys_date "+v_date+"st_date "+date.getF_date()+"end_date "+date.getE_date()); if (v_date.compareTo(date.getF_date())<0 || v_date.compareTo(date.getE_date())>0) { result=0; FacesMessage message = new FacesMessage("خطأ تاريخ خارح السنة المالية"); FacesContext.getCurrentInstance().addMessage(null, message); } if (result==1) { /*****************************************************************/ System.out.println("rrrrrrr "+v_date_st); System.out.println("qqqqqq "+v_id); String username = "mon"; String password = "mon"; String thinConn = "jdbc:oracle:thin:@localhost:1521:ORCL"; String sql= "Begin\n" + "Update Fin_Year F\n" + "Set F.Sys_Date=to_date('"+v_date_st+"','yyyy-mm-dd')\n" + "Where \n" + "F.Date_Id="+v_id+" ;\n" + "Commit;\n" + "End;" ; try { FacesContext context = FacesContext .getCurrentInstance(); DriverManager.registerDriver(new OracleDriver()); Connection conn = DriverManager.getConnection(thinConn,username,password); Statement stat=conn.createStatement(); stat.execute(sql) ; FacesMessage msg = new FacesMessage("تم تعديل التاريخ"); FacesContext.getCurrentInstance().addMessage(null, msg); conn.close(); stat.close(); update_Y=1; context.getExternalContext().getSessionMap().put("dateKey", date); DCBindingContainer DCB = (DCBindingContainer)getBindings(); DCIteratorBinding iterator = DCB.findIteratorBinding("FinYearView1Iterator"); iterator.executeQuery(); System.out.println("mainmainmain"); System.out.println("تم تعديل التاريخ"+update_Y); /* return "main"; */ } catch (SQLException e) { // TODO: Add catch code update_Y=0; e.printStackTrace(); System.out.println("xxxxx "+sql+"yyyyy "+e); System.out.println("لم يتم تعديل التاريخ"+update_Y); FacesMessage msg = new FacesMessage(" لم يتم تعديل التاريخ"); FacesContext.getCurrentInstance().addMessage(null, msg); } } } else { FacesMessage msg = new FacesMessage("لا توجد بيانات"); FacesContext.getCurrentInstance().addMessage(null, msg); update_Y=0; System.out.println("لا توجد بيانات"+update_Y); return null; } }catch (Exception e) { // TODO: Add catch code e.printStackTrace(); } System.out.println(" 22تم تعديل التاريخ"+update_Y); System.out.println("return null "+update_Y); return null; } public oracle.binding.BindingContainer getBindings() { return BindingContext.getCurrent().getCurrentBindingsEntry(); } public String GetCurrentRow_action() { oracle.binding.BindingContainer bindings = getBindings(); OperationBinding operationBinding = bindings.getOperationBinding("Commit"); Object result = operationBinding.execute(); if (!operationBinding.getErrors().isEmpty()) { return null; } return null; } public void setOt6(RichLink ot6) { this.ot6 = ot6; } public RichLink getOt6() { return ot6; } public void setOt8(RichOutputText ot8) { this.ot8 = ot8; } public RichOutputText getOt8() { return ot8; } public void setS1(RichSpacer s1) { this.s1 = s1; } public RichSpacer getS1() { return s1; } public void setS2(RichSpacer s2) { this.s2 = s2; } public RichSpacer getS2() { return s2; } } تقديم بلاغ
بتاريخ: 7 ديسمبر 20169 سنة كاتب الموضوع comment_280535 ال partialTrigger اللى على الزرار المطلوب تطبيق عليه ال disable تقديم بلاغ
بتاريخ: 7 ديسمبر 20169 سنة كاتب الموضوع comment_280549 ده الزرار المطلوب التحكم فى ال diasable للتحكم فى تنفيذ action="*ExecuteParameter" وفقا لقيمة المتغير update_Y <af:link id="ot6" binding="#{backing_fin_year.ot6}" inlineStyle="background-color:Yellow; font-size:x-large; font-weight:bold;" text="#{backing_fin_year.userName}" disabled="#{backing_fin_year.update_Y!=1?'true':'false'}" action="*ExecuteParameter"> <af:setPropertyListener from="#{backing_fin_year.userName}" to="#{pageFlowScope.xxxx}" type="action"/> </af:link> تقديم بلاغ
بتاريخ: 7 ديسمبر 20169 سنة comment_280551 انظر للحقل الذي يغير القيمة update_y وضع عليه autoSubmit وضع partialTrigger على الزر تقديم بلاغ
بتاريخ: 7 ديسمبر 20169 سنة كاتب الموضوع comment_280553 المشكلة يا باشمهندس فى الحقل المربوط بالمتعير update_Y هو ده اللى قيمته ما بتتغيرش على الصفحة بالرغم ل من انه بيتغير داخل ال java bean لما باربط من الصفحة مع ال java bean بتبقى موجودة فى jsf managebean وليس من adf managebean هل يوجد فرق ام ده خطأ من عندى تقديم بلاغ
بتاريخ: 8 ديسمبر 20169 سنة كاتب الموضوع comment_280557 طيب كده المشكلة وضحت وهى المشكلة يا باشمهندس فى الحقل المربوط بالمتعير update_Y هو ده اللى قيمته ما بتتغيرش على الصفحة بالرغم ل من انه بيتغير داخل ال java bean <af:outputText value="#{backing_fin_year.update_Y}" id="ot8" binding="#{backing_fin_year.ot8}"/> تعطى صفر System.out.println("update_Y= "+update_Y); تعطى 1 return null; disabled="#{backing_fin_year.update_Y!=1?'true':'false'}" تعطى disable على طول تقديم بلاغ
بتاريخ: 8 ديسمبر 20169 سنة comment_280558 جرب وضع المتغير update_Y كعنصر attribute داخل view object تقديم بلاغ
بتاريخ: 8 ديسمبر 20169 سنة كاتب الموضوع comment_280583 شكرا يا باشمهندس هو لقيت حل ان انقل تنفيذ ال return "*ExecuteParameter"; داخل ال hava bean لما تتحقق الشروط المطلوبه بدلا من disable اللى على الصفحة واتحلت المشكلة بس مش عارف ليه ال variable اللى على ال java bean ما اتنقلتش على الصفحة تقديم بلاغ
بتاريخ: 8 ديسمبر 20169 سنة comment_280585 الأمر أحياناً يحتاج إلى وقت لتتبع الخطأ لكن عموماً طالما وجدت الحل فلا بأس تقديم بلاغ
انضم إلى المناقشة
يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.