Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <managed-bean-scope>session</managed-bean-scope></managed-bean>
- private articulo actual;
- private List<articulo> lista = new ArrayList();
- private String mensaje;
- public man_articulos() {
- actual = new articulo();
- modelo_articulo modelo = new modelo_articulo();
- try {
- lista = modelo.obtener_articulos();
- }
- catch (SQLException ex) {
- mensaje = ex.getMessage();
- }
- }
- /**
- * @return the actual
- */
- public articulo getActual() {
- return actual;
- }
- /**
- * @param actual the actual to set
- */
- public void setActual(articulo actual) {
- this.actual = actual;
- }
- /**
- * @return the lista
- */
- public List<articulo> getLista() {
- return lista;
- }
- /**
- * @param lista the lista to set
- */
- public void setLista(List<articulo> lista) {
- this.lista = lista;
- }
- /**
- * @return the mensaje
- */
- public String getMensaje() {
- return mensaje;
- }
- /**
- * @param mensaje the mensaje to set
- */
- public void setMensaje(String mensaje) {
- this.mensaje = mensaje;
- }
- public void buscar()
- {
- modelo_articulo modelo =new modelo_articulo();
- try{
- lista =modelo.obtener_articulos_nombre(this.actual.getArtNombre());
- }
- private Connection con = null;
- private String url;
- private String usuario;
- private String contrasena;
- public Connection conectar() {
- try {
- Class.forName("com.mysql.jdbc.Driver");
- } catch (ClassNotFoundException e) {
- System.out.println("no se puede encontrar a clase Mysql");
- }
- try
- {
- url = "jdbc:mysql://localhost:3306/produccion";
- usuario = "root";
- contrasena = "";
- con = DriverManager.getConnection(url, usuario, contrasena);
- } catch (Exception e)
- {
- System.out.println("Errot al crear la conexion");
- }
- System.out.println("getConnection");
- return con;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement