Advertisement
Guest User

Untitled

a guest
Jul 4th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. <managed-bean-scope>session</managed-bean-scope></managed-bean>
  2.  
  3. private articulo actual;
  4. private List<articulo> lista = new ArrayList();
  5. private String mensaje;
  6.  
  7. public man_articulos() {
  8. actual = new articulo();
  9. modelo_articulo modelo = new modelo_articulo();
  10. try {
  11. lista = modelo.obtener_articulos();
  12. }
  13. catch (SQLException ex) {
  14. mensaje = ex.getMessage();
  15. }
  16.  
  17. }
  18.  
  19. /**
  20. * @return the actual
  21. */
  22. public articulo getActual() {
  23. return actual;
  24. }
  25.  
  26. /**
  27. * @param actual the actual to set
  28. */
  29. public void setActual(articulo actual) {
  30. this.actual = actual;
  31. }
  32.  
  33. /**
  34. * @return the lista
  35. */
  36. public List<articulo> getLista() {
  37. return lista;
  38. }
  39.  
  40. /**
  41. * @param lista the lista to set
  42. */
  43. public void setLista(List<articulo> lista) {
  44. this.lista = lista;
  45. }
  46.  
  47. /**
  48. * @return the mensaje
  49. */
  50. public String getMensaje() {
  51. return mensaje;
  52. }
  53.  
  54. /**
  55. * @param mensaje the mensaje to set
  56. */
  57. public void setMensaje(String mensaje) {
  58. this.mensaje = mensaje;
  59. }
  60. public void buscar()
  61. {
  62. modelo_articulo modelo =new modelo_articulo();
  63. try{
  64. lista =modelo.obtener_articulos_nombre(this.actual.getArtNombre());
  65. }
  66.  
  67. private Connection con = null;
  68. private String url;
  69. private String usuario;
  70. private String contrasena;
  71.  
  72. public Connection conectar() {
  73. try {
  74. Class.forName("com.mysql.jdbc.Driver");
  75. } catch (ClassNotFoundException e) {
  76. System.out.println("no se puede encontrar a clase Mysql");
  77. }
  78. try
  79. {
  80. url = "jdbc:mysql://localhost:3306/produccion";
  81. usuario = "root";
  82. contrasena = "";
  83. con = DriverManager.getConnection(url, usuario, contrasena);
  84.  
  85. } catch (Exception e)
  86. {
  87. System.out.println("Errot al crear la conexion");
  88. }
  89. System.out.println("getConnection");
  90. return con;
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement