{"id":107444,"date":"2025-05-04T02:50:10","date_gmt":"2025-05-03T22:20:10","guid":{"rendered":"https:\/\/nabfollower.com\/blog\/ejemplo-de-vista-jsp-17n2\/"},"modified":"2025-05-04T02:50:10","modified_gmt":"2025-05-03T22:20:10","slug":"ejemplo-de-vista-jsp-17n2","status":"publish","type":"post","link":"https:\/\/nabfollower.com\/blog\/ejemplo-de-vista-jsp-17n2\/","title":{"rendered":"\u0645\u062b\u0627\u0644 JSP &#8211; \u062c\u0627\u0645\u0639\u0647 dev"},"content":{"rendered":"<div data-article-id=\"2456877\" id=\"article-body\">\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>**&lt;%@ taglib prefix=\"form\" uri=\"http:\/\/www.springframework.org\/tags\/form\" %&gt;\n&lt;%@ page import=\"java.util.List\" %&gt;\n&lt;%@ page import=\"es.uma.taw.libroswebapp.entity.LibroEntity\" %&gt;\n&lt;%@ page import=\"es.uma.taw.libroswebapp.entity.EscritorEntity\" %&gt;\n&lt;%@ page import=\"es.uma.taw.libroswebapp.entity.GeneroEntity\" %&gt;&lt;%--\n  Created by IntelliJ IDEA.\n  User: guzman\n  To change this template use File | Settings | File Templates.\n--%&gt;\n\n&lt;%@ page contentType=\"text\/html;charset=UTF-8\" language=\"java\" %&gt;\n\n\n    <title>Lista de libros:<\/title>\n\n\n&lt;%\n    List<libroentity> lista = (List<libroentity>) request.getAttribute(\"libros\");\n    List<generoentity> generos2 = (List<generoentity>)request.getAttribute(\"generos2\");\n%&gt;\n\n<include page=\"cabecera.jsp\"\/>\n\n\n\n\n\n&lt;%--action = \"donde se perocesa el formulario (direccion de controlador o metodo)\"--%&gt;\n&lt;%--modelAttribute = nombre identificativo del atributo del model--%&gt;\n&lt;%--path = \"hace referencia a los getters y setters de las Entity\"--%&gt;\n\n&lt;%--- El atributo `modelAttribute=\"filtro\"` indica que el formulario est\u00e1 ligado a un objeto de modelo llamado \"filtro\". Esto permite que Spring MVC --%&gt;\n&lt;%--ligue autom\u00e1ticamente los valores enviados por el formulario a las propiedades correspondientes de dicho objeto.--%&gt;\n&lt;%--- La propiedad `path=\"nombre\"` indica que el valor ingresado en este campo se asignar\u00e1 a la propiedad \"nombre\" del objeto \"filtro\".--%&gt;\n&lt;%--- (como path pero para listas)`items=\"${generos}\"` utiliza una variable del \u00e1mbito de p\u00e1gina (por ejemplo, request o model) llamada \"generos\", que es una lista de objetos que contienen informaci\u00f3n sobre los g\u00e9neros.--%&gt;\n\n&lt;%----%&gt;\n\n\n\n<table border=\"1\">\n    <tr>\n        <th>ID<\/th>\n        <th>NOMBRE<\/th>\n        <th>A\u00d1O PUBLICACI\u00d3N<\/th>\n        <th>EDITORIAL<\/th>\n        <th>ESCRITOR<\/th>\n        <th>GENERO<\/th>\n    <\/tr>\n    &lt;%\n        for (LibroEntity libro : lista) {\n    %&gt;\n    <tr>\n        <td>&lt;%=libro.getLibroid()%&gt;<\/td>\n        <td>&lt;%=libro.getLibroname()%&gt;<\/td>\n        <td>&lt;%=libro.getYearreleased()%&gt;<\/td>\n        <td>&lt;%=libro.getEditorialid().getEditorialname()%&gt;<\/td>\n        <td>\n            &lt;%\n                List<escritorentity> escritores = libro.getEscritorList();\n                for (int i = 0; i &lt; escritores.size(); i++) {\n                    out.print(escritores.get(i).getEscritorname());\n                    if (i &lt; escritores.size() - 1) out.print(\", \");\n                }\n            %&gt;\n        <\/escritorentity><\/td>\n\n        <td>\n            &lt;%\n                List<generoentity> generos = libro.getGeneroList();\n                for (int i = 0; i &lt; generos.size(); i++) {\n                    out.print(generos.get(i).getGeneroname());\n                    if (i &lt; generos.size() - 1) out.print(\", \");\n                }\n            %&gt;\n        <\/generoentity><\/td>\n\n        <td>\n            \n        <\/td>\n        <td>Borrar<\/td>\n    <\/tr>\n&lt;%\n    }\n%&gt;\n<\/table>\n<br\/>\n\n\n**\n<\/generoentity><\/generoentity><\/libroentity><\/libroentity><\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>**&lt;%@ taglib prefix=&#8221;form&#8221; uri=&#8221;http:\/\/www.springframework.org\/tags\/form&#8221; %&gt; &lt;%@ page import=&#8221;java.util.List&#8221; %&gt; &lt;%@ page import=&#8221;es.uma.taw.libroswebapp.entity.LibroEntity&#8221; %&gt; &lt;%@ page import=&#8221;es.uma.taw.libroswebapp.entity.EscritorEntity&#8221; %&gt; &lt;%@ page import=&#8221;es.uma.taw.libroswebapp.entity.GeneroEntity&#8221; %&gt;&lt;%&#8211; Created by IntelliJ IDEA. User: guzman To change this template use File | Settings | File Templates. &#8211;%&gt; &lt;%@ page contentType=&#8221;text\/html;charset=UTF-8&#8243; language=&#8221;java&#8221; %&gt; Lista de libros: &lt;% List lista = (List) request.getAttribute(&#8220;libros&#8221;); List generos2 &hellip;<\/p>\n","protected":false},"author":2,"featured_media":107445,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"","fifu_image_alt":"","footnotes":""},"categories":[339],"tags":[],"class_list":["post-107444","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dev"],"_links":{"self":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/posts\/107444","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/comments?post=107444"}],"version-history":[{"count":0,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/posts\/107444\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/media\/107445"}],"wp:attachment":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/media?parent=107444"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/categories?post=107444"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/tags?post=107444"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}