Professional Documents
Culture Documents
Struts es un framework de cdigo abierto que se extiende de la API Java Servlet y utiliza
un Modelo, Vista, Controlador (MVC) el cual permite crear mantenibles, extensible y aplicaciones
web flexibles basados en tecnologas estndar, como las pginas JSP, JavaBeans, paquetes de
recursos, y XML.
Lo nombramos MyStrutsApp
Introduction to the Struts Web Framework 8CM1 Arreguin Prez Jenny
Web.xml
Ahora creamos el archivo jsp. Clic Izquierdo en MystrutApp New JSP Lo nombramos como
login.jsp
Introduction to the Struts Web Framework 8CM1 Arreguin Prez Jenny
Creamos un ActionForm Bean, Clic derecho en el Proyecto, New Others. Elegimos la opcin
Struts Struts ActionForm Bean.
Introduction to the Struts Web Framework 8CM1 Arreguin Prez Jenny
En el ActionForm Bean creamos campos, Clic derecho en email Getter and Setter
Introduction to the Struts Web Framework 8CM1 Arreguin Prez Jenny
Ahora generamos una clase Action. Clic derecho en el Proyecto, New Others. Elegimos la opcin
Struts Struts Action. Y la nombramos como LoginAction.
Introduction to the Struts Web Framework 8CM1 Arreguin Prez Jenny
Para acceder a los datos del Bean y preparar el estado de Desvo, debemos modificar el
LoginAction de la siguiente manera:
Introduction to the Struts Web Framework 8CM1 Arreguin Prez Jenny
Ahora configuramos el mensaje de error, para informar al usuario que la validacin ha fallado.
Modificamos en LoginForm de la siguiente forma:
Para que funcione correctamente y coincidad los jsp se deben aadir forward. En struts-config.xml
Clic derecho Struts Add Forward
Y el resultado es el siguiente:
Introduction to the Struts Web Framework 8CM1 Arreguin Prez Jenny