From ea5a63c68ea2001981c8cf5dc7806f71af22a229 Mon Sep 17 00:00:00 2001 From: Bruno Nocera Zanette <brunonzanette@gmail.com> Date: Fri, 23 May 2014 18:33:42 -0300 Subject: [PATCH] Update list-update code to decrease package size Updates the solution for automatic update of "Municipios" option's list on "Estado" OnChange event to decrease response package size in order to save network bandwidth. For this it creates a special view containing only the list, instead of using the default "create" page --- .../estacaojuventude/web/OrgaoExecutorController.java | 2 +- .../WEB-INF/views/municipios/selectmunicipios.jspx | 9 +++++++++ src/main/webapp/WEB-INF/views/municipios/views.xml | 3 +++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 src/main/webapp/WEB-INF/views/municipios/selectmunicipios.jspx diff --git a/src/main/java/br/ufpr/c3sl/estacaojuventude/web/OrgaoExecutorController.java b/src/main/java/br/ufpr/c3sl/estacaojuventude/web/OrgaoExecutorController.java index 4244764..9451fae 100644 --- a/src/main/java/br/ufpr/c3sl/estacaojuventude/web/OrgaoExecutorController.java +++ b/src/main/java/br/ufpr/c3sl/estacaojuventude/web/OrgaoExecutorController.java @@ -67,7 +67,7 @@ public class OrgaoExecutorController { @RequestMapping(value = "/{id}", method = RequestMethod.GET, produces = "text/html") public String get(@PathVariable(value = "id") String uf, @Valid OrgaoExecutor orgaoExecutor, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) { repopulateMunicipios(uf, uiModel, orgaoExecutor); - return "orgaoexecutores/create"; + return "municipios/selectmunicipios"; } void repopulateMunicipios(String uf, Model uiModel, OrgaoExecutor orgaoExecutor) { diff --git a/src/main/webapp/WEB-INF/views/municipios/selectmunicipios.jspx b/src/main/webapp/WEB-INF/views/municipios/selectmunicipios.jspx new file mode 100644 index 0000000..fb84e60 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/municipios/selectmunicipios.jspx @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<div xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:field="urn:jsptagdir:/WEB-INF/tags/form/fields" xmlns:form="urn:jsptagdir:/WEB-INF/tags/form" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:spring="http://www.springframework.org/tags" version="2.0"> + <jsp:directive.page contentType="text/html;charset=UTF-8"/> + <jsp:output omit-xml-declaration="yes"/> + <form:create id="fc_br_ufpr_c3sl_estacaojuventude_OrgaoExecutor" modelAttribute="orgaoExecutor" path="/orgaoexecutores" render="${empty dependencies}" z="ySSBiOgc68ijzLxGB8mEHSqYtyU="> + <field:select field="municipio" id="c_br_ufpr_c3sl_estacaojuventude_OrgaoExecutor_municipio" itemValue="id" items="${municipios}" path="/municipios" z="TsmVkI/NlGQHwdhUUjgjQ8bprz4="/> + </form:create> + <form:dependency dependencies="${dependencies}" id="d_br_ufpr_c3sl_estacaojuventude_OrgaoExecutor" render="${not empty dependencies}" z="AAjeOEHmudaMpa7oWwH71C1aVn0="/> +</div> diff --git a/src/main/webapp/WEB-INF/views/municipios/views.xml b/src/main/webapp/WEB-INF/views/municipios/views.xml index 18109b6..1f1c7ff 100644 --- a/src/main/webapp/WEB-INF/views/municipios/views.xml +++ b/src/main/webapp/WEB-INF/views/municipios/views.xml @@ -13,4 +13,7 @@ <definition extends="default" name="municipios/update"> <put-attribute name="body" value="/WEB-INF/views/municipios/update.jspx"/> </definition> + <definition extends="default" name="municipios/selectmunicipios"> + <put-attribute name="body" value="/WEB-INF/views/municipios/selectmunicipios.jspx"/> + </definition> </tiles-definitions> -- GitLab