Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. package view;
  2.  
  3. import java.sql.Connection;
  4.  
  5. import java.sql.DriverManager;
  6.  
  7. import java.sql.ResultSet;
  8. import java.sql.Statement;
  9.  
  10. import javax.faces.model.ResultSetDataModel;
  11.  
  12. import oracle.adf.view.rich.component.rich.data.RichTable;
  13. import oracle.adf.view.rich.component.rich.input.RichInputText;
  14. import oracle.adf.view.rich.component.rich.output.RichOutputLabel;
  15. import oracle.adf.view.rich.context.AdfFacesContext;
  16.  
  17. public class Method {
  18. private RichInputText txtbox;
  19. private RichOutputLabel lbl;
  20. private RichOutputLabel lbl2;
  21. private RichTable table;
  22.  
  23. public Method() {
  24. }
  25.  
  26. public String textChange() {
  27.  
  28. AdfFacesContext adf = AdfFacesContext.getCurrentInstance();
  29. adf.addPartialTarget(table);
  30. try{
  31. Class.forName("oracle.jdbc.OracleDriver");
  32. Connection con = DriverManager.getConnection("jdbc:oracle:thin:@Jaffer:1521:XE", "HR","hr");
  33. Statement stmt = con.createStatement();
  34. ResultSet rslt = stmt.executeQuery("select JOB_ID from EMPLOYEES where LAST_NAME='King' AND EMAIL='SKING'");
  35. rslt.next();
  36. String str =rslt.getString(1).toString();
  37. rslt = stmt.executeQuery("select * from JOBS where JOB_ID='"+str+"'");
  38. rslt.next();
  39. ResultSetDataModel dataModel=new ResultSetDataModel();
  40. dataModel.setWrappedData(rslt);
  41. table.setValue(dataModel);
  42. //txtbox.setValue(rslt.getString(1).toString());
  43. }catch (Exception e){
  44. }
  45. return null;
  46. }
  47.  
  48. public void setTxtbox(RichInputText txtbox) {
  49. this.txtbox = txtbox;
  50. }
  51.  
  52. public RichInputText getTxtbox() {
  53. return txtbox;
  54. }
  55.  
  56. public void setLbl(RichOutputLabel lbl) {
  57. this.lbl = lbl;
  58. }
  59.  
  60. public RichOutputLabel getLbl() {
  61. return lbl;
  62. }
  63.  
  64. public void setLbl2(RichOutputLabel lbl2) {
  65. this.lbl2 = lbl2;
  66. }
  67.  
  68. public RichOutputLabel getLbl2() {
  69. return lbl2;
  70. }
  71.  
  72. public void setTable(RichTable table) {
  73. this.table = table;
  74. }
  75.  
  76. public RichTable getTable() {
  77. return table;
  78. }
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement