Java Struts Framework. Juan Fco. Rodríguez Hervella



Documentos relacionados
DESARROLLO DE APLICACIONES WEB Introducción a Struts Framework

Java Struts Framework

Fundamentos para el desarrollo de aplicaciones en la red. Tema: Frameworks de desarrollo sobre páginas JSP. Autor: Elías Niño

FUNCIONAMIENTO: FUNCIONALIDAD

Struts [parte I]

La vista: ActionForms y taglibs propias

Especialista Universitario Java Enterprise. Struts. Sesión 4: Introducción a Struts Depto. Ciencia de la Computación e IA

4. CODIFICACIÓN. Previo a la codificación además de instalar las respectivas herramientas es. importante tenerlas bien configuradas.

DIPLOMATURA DESARROLLO DE APLICACIONES JAVA

Struts. Sesión 1. Introducción a Struts: el controlador y las acciones. Especialista Universitario Java Enterprise

Struts. Sesión 2: La vista en Struts. ActionForms y taglibs propias. Especialista Universitario Java Enterprise

Lección 1 Introducción a Struts. uacosta@globalmentoring.com.mx

Struts. Índice. Copyright Dept. Ciencia de la Computación e IA All rights reserved.

A continuación en la figura D.1 se verá el código de una implementación del archivo struts-config.xml:

Curso Desarrollo Java Web con JSP, Servlets y el MVC

Desarrollo y servicios web Sesión 18

Laboratorio. Desplegando listas.

3.1 Escribiendo una aplicación en Struts

Requisitos. Universidad ORT Arquitectura de Software

Este proyecto tiene como finalidad la creación de una aplicación para la gestión y explotación de los teléfonos de los empleados de una gran compañía.

MVC (Model-View-Controller)

Diplomado Avanzado de Java (Struts & Java Persistence with Hibernate, Web Services)

Ficha Técnica. Categoría. Contenido del Pack. Sinopsis. Programación. - 2 Manual Teórico - 1 Cuaderno de Ejercicios - 1 CDROM

Contiene código HTML normal junto elementos especiales de JSP. Internamente, el servidor de aplicaciones las compilará a un servlet

Java web: servlets, Jsp, Jstl, Struts & Ajax

Creating your Single Sign-On Account for the PowerSchool Parent Portal

J2EE Java 2 Enterprise Edition

Java Web J2EE con JSP

J2EE TIENDAVIRTUAL APPLICATION FRAMEWORK

Diplomado Java Web Programming with Servlets, JSP, JSF & Ajax

Curso Java Web (JSP's/Servlets)

NIVEL 16: ESTRUCTURAS N-ARIAS RECURSIVAS Aplicaciones Web, Html y Servlets. ISIS1206 Estructuras de Datos

Ejemplo integrador del capítulo 7

Diplomado Avanzado de Java (J2EE, Struts & Java Persistence with Hibernate)

Diseño e implementación de una tienda electrónica mediante Struts y SOAP. Rocío López Valladolid Tutor: Dr. Abelardo Pardo Sánchez

TEMARIO. 4-Servlet Definición de servlet El Web Container y el ciclo de vida de los servlets El ciclo request- response.

MANUAL EASYCHAIR. A) Ingresar su nombre de usuario y password, si ya tiene una cuenta registrada Ó

PASO 1: Creamos un nuevo proyecto en NetBeans. Nos vamos a File y pulsamos sobre New Project

Struts2. 06 de Noviembre de 2009

Spring MVC. Desarrollo de Aplicaciones Empresariales

4.4 Tutorial de JSP 2.0, JSTL y Apache Struts

Programación JAVA utilizando IDE Eclipce

Experto Universitario Java Enterprise Spring

MVC. Modelo Vista - Controlador

Volatilidad: Noviembre 2010 Futuros Frijol de Soya

<?xml version="1.0" encoding="utf-8"?> <portlet-app xmlns="

Manual de Desarrollo de Aplicaciones J2EE

Anexo de documentación

U IVERSIDAD CARLOS III DE MADRID. Escuela Politécnica Superior. Ingeniería Técnica de Telecomunicación: Telemática

Escribir código HTML en los servlets es tedioso. que hay que utilizar las instrucciones print, println, etc. Es decir, HTML está dentro de java.

Introducción (1) En una aplicación web, especialmente en Internet, los cambios a la interfaz gráfica son muy frecuentes

Ejemplos de Servlet y JSP Web Application Development

Agustiniano Ciudad Salitre School Computer Science Support Guide Second grade First term

UNIVERSIDAD DON BOSCO FACULTAD DE ESTUDIOS TECNOLÓGICOS

Restaurant-OnLine. Juan Carlos Serra Diaz ETIG. Verónica Peña Pastor

FCC Information : Warning: RF warning statement:

Java 2 Enterprise Edition

Tema 6: Arquitectura Web Multicapa

Profesor: José Luis Montoya Restrepo

Guía de Instalación Oracle Business Intelligence Enterprise Edition ( ) Advanced Installation Type

Taller de Sistemas de Información 2. Desarrollo Web

4.5 Caso de estudio: diseño e implementación de las capas controlador y vista de MiniBank con JSTL y Jakarta Struts.

2007, Grupo Salenda, S.L.

Introducción al Diseño con Patrones

USANDO SERVLETS EN UN SERVIDOR WEB RESIN

Experto Universitario Java Enterprise Spring

LAC Modificación DIRECT ALLOCATIONS TO ISPs DISTRIBUCIONES INICIALES A ISPs

07 Java EE Tarea 7. Laboratorio de proyectos de tecnologías de la información III Prof. Emmanuel Oropeza Gonzalez

Modulo osc2psdc. 1. English Documentation (Ingles) 2. Documentación en Español (Spanish) 1. English Documentation (Ingles) Introduction.

JSF 2.0 (Java Server Faces) Yadira Jarvio Hernández

Mario Muñoz Organero & Norberto Fernández * Departamento de Ingeniería Telemática

Introducción a JSF con NetBeans

Connecting Cloudino Connector to FIWARE IoT

Java Servlets. Luis Fernando Llana Díaz. 17 de abril de Departamento de Sistemas Informáticos y ProgramaciónUniversidad Complutense de Madrid

Identidad Corporativa de ICM 1 TABLA DE CONTENIDO INTRODUCCIÓN COMPONENTES NECESARIOS... 3

Transcripción:

Java Struts Framework Juan Fco. Rodríguez Hervella

Indice Introducción Struts Framework Ejemplo Conclusiones. Título 2

Introducción Entorno para la construcción de aplicaciones web. Basado en el patrón Modelo-Vista-Controlador (MVC) Model 1: JSP-centric Model 2: Struts http://jakarta.apache.org/struts Título 3

Introducción State query Model State change Change notification View View selection User actions Controller Título 4

Introducción Desacopla la vista del modelo El controlador selecciona: Los datos. La vista que visualiza los datos. Presentation Control Application Layer Layer Logic DDBB Título 5

Struts Framework Título 6

Struts Framework JSP JSP response response Initial Page submit ACTION ActionForm (JSP/HTML) SERVLET Action struts-config.xml Título 7

Clases Object Action An Action is an adapter between the contents of an incoming HTTP request and the corresponding business logic that should be executed to process this request. The controller will select an appropriate Action for each request, create an instance (if necessary), and call the execute method. ActionForm ActionMapping An ActionForm is a JavaBean optionally associated with one or more ActionMappings. Such a bean will have had its properties initialized from the corresponding request parameters before the corresponding Action.execute method is called. An ActionMapping represents the information that the controller knows about the mapping of a particular request to an instance of a particular Action class. The ActionMapping instance used to select a particular Action is passed on to that Action, thereby providing access to any custom configuration information included with the ActionMapping object. Título 8

Clases Object Action ActionForward ActionServlet An ActionForward represents a destination to which the controller might be directed to perform a forward or redirect as a result of processing activities of an Action class. Instances of this class may be created dynamically as necessary, or configured in association with an ActionMapping instance for named lookup of potentially multiple destinations for a particular mapping instance (if necessary), and call the execute method. ActionServlet provides the "controller" in the Model-View- Controller (MVC) design pattern for web applications that is commonly known as "Model 2". Action_1 Action_2... User defined actions Título 9

Resumen Clase Descripción ActionForward Datos para realizar un cambio de estado ActionForm Los datos asociados a un cambio de estado ActionMapping Evento de cambio de estado ActionServlet Action El controlador que recibe peticiones de usuario, cambios de estado y reeenvía las vistas seleccionadas La parte del controlador que interacciona con el modelo para ejecutar los cambios de estado y comunica al ActionServlet la vista seleccionada. Título 10

Ejemplo de uso Título 11

Ejemplo de uso Tomcat-5.0.19 Struts-1.1 Java-1.4.2 (FreeBSD-4.10) actions beans ejbs helpers LogonAction.java LogonForm.java src web build.xml WEB-INF index.jsp tags struts-config.xml web.xml Título 12

LogonAction.java public class LogonAction extends Action { public ActionForward execute (ActionM apping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse res) { LogonForm lf= (LogonForm) form; String username = lf.getusername(); String password = lf.getpassword(); Título 13

LogonAction.java... if( gestor.dologin( username, password ) == false ) { return mapping.findforward("failure"); } else {... return mapping.findforward("administrador");... } } /* execute() */ } /* class */ Título 14

LogonForm.java public class LogonForm extends ActionForm { protected String username; protected String password; public String getusername(){return this.username;}; public String getpassword(){return this.password;}; } public void setusername(string username){this.username=username;}; public void setpassword(string password){this.password=password;}; Título 15

index.jsp <%@ taglib uri="/web-inf/tags/struts-bean.tld" prefix="bean" %> <%@ taglib uri="/web-inf/tags/struts-html.tld" prefix="html" %> <%@ taglib uri="/web-inf/tags/struts-logic.tld" prefix="logic" %> <html><body><center> <html:form action="/logonsubmit.do" focus="username"> <table border="0" width="100%"> <tr> <td align="center">username:<html:text property="username"/></td></tr> <tr> <td align="center">password:<html:text property="password"/></td></tr> <tr> <td align="center"><html:submit/><html:reset/></td></tr> </table> </html:form></center></body></html> Título 16

struts-config.xml <struts-config>... <form-beans> <form-bean name="logonform" type="beans.logonform"> <form-property name="username" type="java.lang.string"/> <form-property name="password" type="java.lang.string"/> </form-bean> </form-beans>... Título 17

struts-config.xml... <action-mappings> <action path="/logonsubmit" type="actions.logonaction" name="logonform" scope="session"> <forward name="failure" path="/index.jsp"/> </action> </action-mappings>... </struts-config> Título 18

Conclusiones Título 19

Puntos fuertes: Conclusiones Basado en patrones de diseño (MVC, layers...) Potente conjunto de librerias JSP (tag-libraries). http-centric, model-neutral. Puntos débiles: No hay modelo de eventos. Sólo un ActionServlet por aplicación web. model-neutral, learning-curve, nomenclature Título 20

Bibliografía [1] T. Husted, Struts in Action, Manning Publications, 2003 [2] M. Floyd, EJB design patterns: advanced patterns, processes and idioms, NY, John Wiley & Sons, 2002 [3] http://jakarta.apache.org/struts Título 21