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

 

 


Tema destacado: Estamos en la red social de Mastodon


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  Java
| | | |-+  Hola una duda con Struts
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Hola una duda con Struts  (Leído 3,743 veces)
Mr pom0

Desconectado Desconectado

Mensajes: 120



Ver Perfil
Hola una duda con Struts
« en: 26 Febrero 2010, 04:37 am »

Hola no se si este tema va a qui o en desarrollo web :-\  espero y me puedan ayudar estoy aprendiendo struts  usando java beans pero no c como hacer para ver los datos de que guarde espero y me puedan ayudar aqui les dejo el codigo gracias

index.jsp
Código:
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<jsp:forward page="Form.do"/>


RegistroForm.java
Código:
package javabeans;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.*;

public class RegistroForm extends ActionForm {

    private String nombre;
    private String apellidos;
    private String usuario;
    private String password;
    private String email;

    //metodos de acceso
    public String getNombre() {
        return nombre;
    }//Fin del getnombre

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }//Fin del setNombre

    public String getApellidos() {
        return apellidos;
    }//Fin del getAmeppidos

    public void setApellidos(String apellidos) {
        this.apellidos = apellidos;
    }//Fin del setApellidos

    public String getUsuario() {
        return usuario;
    }//Fin del getUsuario

    public void setUsuario(String usuario) {
        this.usuario = usuario;
    }//Fin del setUsuario

    public String getPassword() {
        return password;
    }//Fin del getPassword

    public void setPassword(String password) {
        this.password = password;
    }//Fin del setPassword

    public String getEmail() {
        return email;
    }//Fin del getEmail

    public void setEmail(String email) {
        this.email = email;
    }//Fin setEmail
}//Fin del la clase


Formulario.jsp

Código:
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<html:html>
    <body>
        <center>
    <h1>Registro de Usuario</h1>
    <html:form action="/registrar" method="POST">
        <table>
            <tr>
                <td>Nombre:</td>
                <td><html:text property="nombre"/></td>
            </tr
            <tr>
                <td>Apellidos:</td>
                <td><html:text property="apellidos"/></td>
            </tr>
            <tr>
                <td>Usuario:</td>
                <td><html:text property="usuario"/></td>
            </tr>
            <tr>
                <td>Password:</td>
                <td><html:password property="password"/></td>
            </tr>
            <tr>
                <td>Email:</td>
                <td><html:text property="email"/></td>
            </tr>
        </table>
                <html:submit property="submit" value="Registrar"/>
                &nbsp;&nbsp;
                <html:reset value="Limpiar"/>
    </html:form>
        </center>
    </body>
</html:html>

struts-config.xml

Código:
<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE struts-config PUBLIC
          "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
          "http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd">


<struts-config>
    <form-beans>
     <form-bean name="RegistroForm" type="javabeans.RegistroForm"/>
    </form-beans>
    
    <global-exceptions>
    
    </global-exceptions>

    <global-forwards>
        <forward name="form"  path="/Form.do"/>
    </global-forwards>

    <action-mappings>
        <action path="/Form" forward="/Formulario.jsp"/>
        
        
    </action-mappings>
    
    <controller processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>

    <message-resources parameter="com/myapp/struts/ApplicationResource"/>    
    
    <!-- ========================= Tiles plugin ===============================-->
    <!--
    This plugin initialize Tiles definition factory. This later can takes some
    parameters explained here after. The plugin first read parameters from
    web.xml, thenoverload them with parameters defined here. All parameters
    are optional.
    The plugin should be declared in each struts-config file.
    - definitions-config: (optional)
    Specify configuration file names. There can be several comma
    separated file names (default: ?? )
    - moduleAware: (optional - struts1.1)
    Specify if the Tiles definition factory is module aware. If true
    (default), there will be one factory for each Struts module.
    If false, there will be one common factory for all module. In this
    later case, it is still needed to declare one plugin per module.
    The factory will be initialized with parameters found in the first
    initialized plugin (generally the one associated with the default
    module).
    true : One factory per module. (default)
    false : one single shared factory for all modules
    - definitions-parser-validate: (optional)
    Specify if xml parser should validate the Tiles configuration file.
    true : validate. DTD should be specified in file header (default)
    false : no validation

    Paths found in Tiles definitions are relative to the main context.
    -->
    <plug-in className="org.apache.struts.tiles.TilesPlugin" >
        <set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml" />      
        <set-property property="moduleAware" value="true" />
    </plug-in>
    
    <!-- ========================= Validator plugin ================================= -->
    <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
        <set-property
            property="pathnames"
            value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
    </plug-in>
  
</struts-config>


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
java struts 2: cuando se ejecuta execute?
Desarrollo Web
Kase 0 2,807 Último mensaje 19 Abril 2011, 02:31 am
por Kase
Hola una duda
Programación C/C++
ellandax 3 1,744 Último mensaje 17 Abril 2013, 02:40 am
por rir3760
Duda con java y struts
Java
luismi_12 1 1,470 Último mensaje 15 Marzo 2014, 21:55 pm
por Mitsu
Apache Struts y los peligros de la teletransportación
Noticias
wolfbcn 0 1,287 Último mensaje 15 Septiembre 2017, 01:30 am
por wolfbcn
Spring, struts e hibernate
Java
Raijin 2 1,945 Último mensaje 9 Marzo 2019, 14:05 pm
por rub'n
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines