elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Los 10 CVE más críticos (peligrosos) de 2020


  Mostrar Mensajes
Páginas: [1]
1  Programación / Java / Re: ¿Que es J2EE?¿Es lo mismo que java o es una version del mismo? en: 18 Julio 2012, 05:48 am
Hola

J2SE= JRE + librerias, herramientas y compilador para desarrollo. (Para el programador)
Basicamente J2SE es un conjunto de clases e interfases para desarrollo de
aplicaciones "simples". Me refiero con simples, por ejemplo a aplicaciones
de escritorio con interfaz de usuario Swing o AWT que son un API para
"dibujar" ventanas.

J2EE = J2SE + Librerias para aplicaciones empresariales (JMS,EJB,JAX-WS,etc)
J2EE es un grupo de especificaciones diseñadas por Sun que permiten la creación de          aplicaciones empresariales, esto sería: acceso a base de datos (JDBC), utilización de directorios distribuidos (JNDI), acceso a métodos remotos (RMI/CORBA), funciones de correo electrónico (JavaMail), aplicaciones Web(JSP y Servlets)...etc. Aquí es importante notar que J2EE es solo una especificación, esto permite que diversos productos sean diseñados alrededor de estas especificaciones algunos son Tomcat y Weblogic.       
       

Salu2



Suerte (^.^)
Horny3
2  Programación / Java / Re: Validar usuario y contraseña en: 17 Julio 2012, 06:18 am
Hola soy nuevo en sto :D pero tal vez sta solucion te ayude... es algo simple..!!

Código
  1. package Login;
  2.  
  3. import java.sql.*;
  4. import javax.swing.JOptionPane;
  5.  
  6. public class FromUsuario extends javax.swing.JFrame
  7. {
  8.    private Connection cn= null;
  9.    private Statement st= null;
  10.    private ResultSet rs= null;
  11.    private String usuario;
  12.    private String password;
  13.  
  14.    Usuarios usuClase= new Usuarios();
  15.  
  16.  
  17.    /** Creates new form FromUsuario */
  18.    public FromUsuario()
  19.    {
  20.        initComponents();
  21.        setLocation(300,240);
  22.    }
  23.    @SuppressWarnings("unchecked")
  24.    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
  25.    private void initComponents() {
  26.  
  27.        jPanel1 = new javax.swing.JPanel();
  28.        txtUsuario = new javax.swing.JTextField();
  29.        jPanel2 = new javax.swing.JPanel();
  30.        txtPassword = new javax.swing.JPasswordField();
  31.        btnIngresar = new javax.swing.JButton();
  32.        btnSalir = new javax.swing.JButton();
  33.  
  34.        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  35.        setTitle("Login");
  36.        setResizable(false);
  37.  
  38.        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Usuario"));
  39.  
  40.        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
  41.        jPanel1.setLayout(jPanel1Layout);
  42.        jPanel1Layout.setHorizontalGroup(
  43.            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  44.            .addGroup(jPanel1Layout.createSequentialGroup()
  45.                .addContainerGap()
  46.                .addComponent(txtUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE)
  47.                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  48.        );
  49.        jPanel1Layout.setVerticalGroup(
  50.            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  51.            .addGroup(jPanel1Layout.createSequentialGroup()
  52.                .addComponent(txtUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  53.                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  54.        );
  55.  
  56.        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Contraseña"));
  57.  
  58.        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
  59.        jPanel2.setLayout(jPanel2Layout);
  60.        jPanel2Layout.setHorizontalGroup(
  61.            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  62.            .addGroup(jPanel2Layout.createSequentialGroup()
  63.                .addContainerGap()
  64.                .addComponent(txtPassword, javax.swing.GroupLayout.DEFAULT_SIZE, 142, Short.MAX_VALUE)
  65.                .addContainerGap())
  66.        );
  67.        jPanel2Layout.setVerticalGroup(
  68.            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  69.            .addGroup(jPanel2Layout.createSequentialGroup()
  70.                .addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  71.                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  72.        );
  73.  
  74.        btnIngresar.setIcon(new javax.swing.ImageIcon("C:\\Users\\user\\Desktop\\Iconos\\icons\\16\\065.png")); // NOI18N
  75.        btnIngresar.setText("Ingresar");
  76.        btnIngresar.addActionListener(new java.awt.event.ActionListener() {
  77.            public void actionPerformed(java.awt.event.ActionEvent evt) {
  78.                btnIngresarActionPerformed(evt);
  79.            }
  80.        });
  81.  
  82.        btnSalir.setIcon(new javax.swing.ImageIcon("C:\\Users\\user\\Desktop\\Iconos\\icons\\16\\101.png")); // NOI18N
  83.        btnSalir.setText("Salir");
  84.        btnSalir.addActionListener(new java.awt.event.ActionListener() {
  85.            public void actionPerformed(java.awt.event.ActionEvent evt) {
  86.                btnSalirActionPerformed(evt);
  87.            }
  88.        });
  89.  
  90.        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  91.        getContentPane().setLayout(layout);
  92.        layout.setHorizontalGroup(
  93.            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  94.            .addGroup(layout.createSequentialGroup()
  95.                .addGap(18, 18, 18)
  96.                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
  97.                    .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  98.                    .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  99.                .addGap(18, 18, 18)
  100.                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  101.                    .addComponent(btnIngresar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  102.                    .addComponent(btnSalir, javax.swing.GroupLayout.DEFAULT_SIZE, 93, Short.MAX_VALUE))
  103.                .addContainerGap())
  104.        );
  105.        layout.setVerticalGroup(
  106.            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  107.            .addGroup(layout.createSequentialGroup()
  108.                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  109.                    .addGroup(layout.createSequentialGroup()
  110.                        .addContainerGap()
  111.                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  112.                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  113.                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  114.                    .addGroup(layout.createSequentialGroup()
  115.                        .addGap(29, 29, 29)
  116.                        .addComponent(btnIngresar, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
  117.                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  118.                        .addComponent(btnSalir, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)))
  119.                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  120.        );
  121.  
  122.        pack();
  123.    }// </editor-fold>                        
  124.  
  125.    private void btnIngresarActionPerformed(java.awt.event.ActionEvent evt) {                                            
  126.        // TODO add your handling code here:
  127.  
  128.        usuClase.setUsuario(txtUsuario.getText());
  129.        usuClase.setClave(txtPassword.getText());
  130.  
  131.        try
  132.        {
  133.            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  134.           cn=DriverManager.getConnection("jdbc:odbc:DSNEjemploBD");
  135.            st=cn.createStatement();
  136.            rs=st.executeQuery("select * from usuarios "
  137.                             + "where usuario='"+usuClase.getUsuario()+"' and "
  138.                             + " clave='"+usuClase.getClave()+"'");
  139.            if (rs.next())
  140.            {
  141.                JOptionPane.showMessageDialog(null,"El Usuario si existe..!!");
  142.            }
  143.            else
  144.            {
  145.                JOptionPane.showMessageDialog(null,"Verifique Usuario oh Password..!!");
  146.            }
  147.        }
  148.        catch (ClassNotFoundException e)
  149.        {
  150.            System.out.println("Error de clase : "+e);
  151.        }
  152.        catch (SQLException e)
  153.        {
  154.            System.out.println("Error de conexión : "+e);
  155.        }
  156.    }                                          
  157.  
  158.    private void btnSalirActionPerformed(java.awt.event.ActionEvent evt) {                                        
  159.        // TODO add your handling code here:
  160.        int rsp;
  161.  
  162.        rsp=JOptionPane.showConfirmDialog(null, "Desea salir de la Aplicacion ..!!","Salir",JOptionPane.YES_NO_OPTION);
  163.  
  164.        if(rsp==JOptionPane.YES_OPTION)
  165.        {
  166.           dispose();
  167.        }
  168.        else
  169.        {
  170.            txtUsuario.setText("");
  171.            txtPassword.setText("");
  172.        }
  173.  
  174.    }                                        
  175.  
  176.    /**
  177.     * @param args the command line arguments
  178.     */
  179.    public static void main(String args[])
  180.    {
  181.        java.awt.EventQueue.invokeLater(new Runnable()
  182.        {
  183.            public void run() {
  184.                new FromUsuario().setVisible(true);
  185.            }
  186.        });
  187.    }
  188.  
  189.    // Variables declaration - do not modify                    
  190.    private javax.swing.JButton btnIngresar;
  191.    private javax.swing.JButton btnSalir;
  192.    private javax.swing.JPanel jPanel1;
  193.    private javax.swing.JPanel jPanel2;
  194.    private javax.swing.JPasswordField txtPassword;
  195.    private javax.swing.JTextField txtUsuario;
  196.    // End of variables declaration                  
  197.  
  198. }
  199.  

Suerte ^.^
Horny3
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines