(Anterior)
Struts
web.xml utilizado en Struts
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<!-- Configuracion del Servlet "Action" -->
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet
</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
|
<!-- Mapeo para el Servlet "Action" -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.st</url-pattern>
</servlet-mapping>
<!-- Parametro no especifico de Struts -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
|
<!-- Cargar Librerias de Struts -->
<taglib>
<taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-template.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-template.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-tiles.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
</taglib>
<!-- Cargar Librerias JSTL -->
<taglib>
<taglib-uri>/WEB-INF/c.tld</taglib-uri>
<taglib-location>/WEB-INF/c.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/x.tld</taglib-uri>
<taglib-location>/WEB-INF/x.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/fmt.tld</taglib-uri>
<taglib-location>/WEB-INF/fmt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/sql.tld</taglib-uri>
<taglib-location>/WEB-INF/sql.tld</taglib-location>
</taglib>
<!-- Cargar Libreria Propietaria Curso JSP -->
<taglib>
<taglib-uri>/WEB-INF/tags-cursojsp.tld</taglib-uri>
<taglib-location>/WEB-INF/tags-cursojsp.tld</taglib-location>
</taglib>
</web-app>
|
La parte medular de Struts es el Servlet llamado ActionServlet que se encuentra en la clase org.apache.struts.action.ActionServlet, éste funciona como el Controlador del diseño "MVC"; este mismo Servlet como se puede observar toma algunos parámetros de configuración :
El parámetro config toma un valor de /WEB-INF/struts-config.xml y es dentro de éste archivo que se incluye aún más información sobre la configuración de Struts, su contenido será descrito en otra sección.
load-on-startup es utilizado para cargar el Servlet al momento de iniciarse el "Servlet Engine"/"Application Server".
Posteriormente, como todo otro Servlet, se indica el mapeo de action hacia la extensión *.st, en otras palabras, toda solicitud para paginas terminadas en *.st será atendidas por el Servlet action o bien el Controlador de Struts , el cual a su vez contiene parametros más extensos dentro de /WEB-INF/struts-config.xml.
Son definidas las paginas "default" que deben ser enviadas para directorios genéricos en el orden index.jsp, index.html.
Finalmente son declaradas las diversas librerías de Tags JSP empleadas con Struts, así como las librerías JSTL y Tags hechos a medida.
|