jmoordbtaller
  • Introducción
  • Requisitos
  • Dependencias
  • Repositorios de proyectos
  • Arquitectura
  • Taller 0. Instalar Java
    • Configurar maven
  • Taller 1 MongoDB
  • Taller 2 CRUD MongoDB
    • Insertar documentos
    • Consulta de documentos
    • Documento embebido
    • Eliminar Documentos
    • Actualizar documentos
    • Agregaciones
    • Crear un indice
  • Taller 3 EJB
    • Crear el proyecto ejb
    • Dependencias
    • Entity
    • Repository
  • Taller 4 Java EE 8
    • dependencias
    • Controller
    • new.xhtml
    • index.hxmtl
    • Ampliar el método save()
    • ejecutar proyecto
    • datatable
    • CommandLink
  • Taller 5- Verificar si existe al guardar
  • Taller 6-Bases datos en tiempo de ejecución e Historial de revisión
  • Taller 7. Aplicar temas
  • Taller 8. Eliminar
  • Taller 9- Editar
  • Taller 10. Historial de revisiones
  • Taller 11.Conocer la llave primaria y el valor en tiempo de ejecucion
  • Taller 12. UserInfo
    • Controller
  • Taller 13. Converter/DataModel/Services
    • Services
    • Converter
    • DataModel
  • Taller 14.Autocomplete
    • Componente autocompletepersona
    • Agregar el componente al list.xhtml
  • Taller 15. Paginacion
    • Pais en Proyecto ejb
    • Pais en Proyecto Web
      • Formularios list.xhmtl, new.xhtml, view.xhtml
      • <e:autocompletepais/>
      • <e:paginator>
    • PaisController.java
      • Metodos
        • init()
        • save()
        • delete()
        • edit()
        • handleAutocompleteOfListXhtml()
        • showAll()
        • move(Integer page)
        • searchBy()
        • prepare
        • desplazarse en las paginas
          • printAll()
          • clear()
        • Codigo Completo
        • index.xhtml
  • Parte II- Avanzado
    • Taller 16. crudejb
      • Agregar dependencias
      • Entity
        • Rol.java
        • Usuario.java
      • Repository
      • Services
      • Datamodel
      • Converter
    • Mongodb
      • Insertar documentos en la colección MongoDB
    • Capitulo 17. Arquetipos
      • Crear el proyecto en base al arquetipo
    • Taller 18. Crear proyecto Web
      • Dependencias
      • web.xml
      • Java EE 8 Security
        • ApplicationConfig.java
        • CustomInMemoryIdentityStore.java
      • properties
      • template
        • footer.xhtml
        • template.xhtml
        • top.xhtml
      • resources
      • index.xhtml
      • login
        • login.xhtml
        • LoginController.java
        • Codigo completo
      • Controller
        • Validar duplicados en un autocomplete multiple
        • RolController.java
        • UsuarioController.java
      • <jmoordbjsf:autocomplete>
      • <jmoordbjsf:search>
      • <jmoordbjsf:paginator>
      • <jmoordbjsf:yesno>
      • <jmoordbjsf:toolbarsave>
      • <jmoordbjsf:toolbarview>
      • pages
        • Rol
          • new.xhtml
          • view.xhtml
        • Usuario
          • new.xhtml
          • view.xhtml
    • Ejecutar el proyecto
  • Parte III-Crear una aplicacion web en base al arquetipo
    • Crear el proyecto
    • Editar el proyecto
    • Editar LoginController
    • Editar los paquetes y clases
    • Indicar la conexion a base de datos
    • Ejecutar el proyecto
  • Parte IV. Reportes con jmoordbreport
    • SubReporte Referenciado de Usuario
  • Parte V. Backup/Restore con jmoordbbackup
  • Parte VII Email
Powered by GitBook
On this page
  • list.xhtml
  • new.xhtml
  • view.xhtml

Was this helpful?

  1. Taller 15. Paginacion
  2. Pais en Proyecto Web

Formularios list.xhmtl, new.xhtml, view.xhtml

PreviousPais en Proyecto WebNext<e:autocompletepais/>

Last updated 5 years ago

Was this helpful?

Dentro de Web-Pages creamos la carpeta pages/pais

Aquí crearemos las paginas:

  • list.xhtml

  • view.xhtml

  • new.xhtml

list.xhtml

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"  
        xmlns:p="http://primefaces.org/ui" 
      xmlns:e="http://xmlns.jcp.org/jsf/composite/extensions">

    <f:view contentType="text/html">
        <h:head>
            <f:facet name="first">
                <meta content='text/html; charset=UTF-8' http-equiv="Content-Type"/>
                <title>PrimeFaces</title>
            </f:facet>
        </h:head>

        <h:body>


            <h:form  id="form" prependId="true">
                <p:messages id="messages" showDetail="true" closable="true">
                    <p:autoUpdate />
                </p:messages>

                <p:panel id="content" header="Paises" 
                         footer="Movie Details" style="margin-bottom:20px">





                    <p:outputLabel value="Id"/>
                    <e:autocompletepais listener="#{paisController.handleAutocompleteOfListXhtml}"
                                        value="#{paisController.paisSearch}"
                                        itemLabel=" #{p.idpais}"
                                        field="idpais"
                                        update=" :form:datatable"/>

                    <p:outputLabel value="Pais"/>
                    <e:autocompletepais listener="#{paisController.handleAutocompleteOfListXhtml}"
                                        value="#{paisController.paisSearch}"
                                        itemLabel=" #{p.pais}"
                                        field="pais"
                                        update=" :form:datatable"/>






                    <p:messages  id="msg"/>



                    <p:dataTable value="#{paisController.paisList}"
                                 var="item"
                                 id="datatable"
                                 paginated="false"
                                 onpage="console.log('page');"
                                 >
                        <f:facet name="header">
                            <e:paginator 
                                rowPage="#{paisController.rowPage}"
                                clear="#{paisController.clear()}"
                                first="#{paisController.first()}"
                                back="#{paisController.back()}"
                                next="#{paisController.next()}"
                                last="#{paisController.last()}"
                                page="#{paisController.page}"
                                pages="#{paisController.pages}"
                                skip="ajax:paisController.skip(paisController.page)" 
                                new="#{paisController.prepareGoNew()}"
                                printAll="#{paisController.printAll()}"
                                />

                        </f:facet>
                        <p:column headerText="Cedula">
                            <p:outputLabel value="#{item.idpais}"/>
                        </p:column>
                        <p:column headerText="Nombre">
                            <p:outputLabel value="#{item.pais}"/>
                        </p:column>


                        <p:column>

                            <p:commandButton                 

                                iconAwesome="fa-edit" 
                                value="Editar"
                                title="Editar"
                                immediate="true"

                                action= "#{paisController.prepareView(item)}" 
                                >


                            </p:commandButton>
                        </p:column>

                        <p:column>
                            <p:commandButton                                             
                                icon="fa-trash-o" 
                                value="Eliminar" 
                                process=":form:datatable" 
                                action="#{paisController.delete(item,false)}" 
                                update=":form:datatable, :form:msg" > 

                            </p:commandButton>
                        </p:column>



                    </p:dataTable>

                    <p:commandButton value="new" action="#{paisController.prepareGoNew()}"/>
                    <br></br>
                    <p:commandLink value="index" action="/index"/>
                </p:panel>
            </h:form>


        </h:body>

    </f:view>
</html>

new.xhtml

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

    <f:view contentType="text/html">
        <h:head>
            <f:facet name="first">
                <meta content='text/html; charset=UTF-8' http-equiv="Content-Type"/>
                <title>PrimeFaces</title>
            </f:facet>
        </h:head>

        <h:body>


            <h:form  id="form" prependId="true">
                <p:messages  id="msg"/>
                <p:panelGrid columns="2">
                    <p:outputLabel value="idpais"/>
                    <p:inputText value="#{paisController.pais.idpais}" required="true"/>
                    <p:outputLabel value="pais"/>
                    <p:inputText value="#{paisController.pais.pais}"  required="true"/>
                  
                </p:panelGrid>
                <p:row>
                    <p:column>
                          <p:commandButton value="save"
                                 action="#{paisController.save}"
                                 update=":form:msg, :form"/>
                    </p:column>
                    <p:column>
                         <p:commandButton value="list" action="#{paisController.prepareGoList()}" immediate="true"/>
                    </p:column>
                   
                </p:row>
              
                
              
            </h:form>

        </h:body>

    </f:view>
</html>

view.xhtml

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

    <f:view contentType="text/html">
        <h:head>
            <f:facet name="first">
                <meta content='text/html; charset=UTF-8' http-equiv="Content-Type"/>
                <title>PrimeFaces</title>
            </f:facet>
        </h:head>

        <h:body>


            <h:form  id="form" prependId="true">
                <p:messages  id="msg"/>
                <p:panelGrid columns="2">
                    <p:outputLabel value="Idpais"/>
                    <p:inputText value="#{paisController.pais.idpais}" disabled="true" required="true"/>
                    <p:outputLabel value="Pais"/>
                    <p:inputText value="#{paisController.pais.pais}"  required="true"/>

                </p:panelGrid>
                <p:row>
                    <p:column>
                        <p:commandButton value="Editar"
                                         rendered="#{paisController.writable}"
                                         action="#{paisController.edit}"
                                         update=":form:msg, :form"/>
                    </p:column>
                    <p:column>
                        <p:commandButton value="Eliminar"
                                         rendered="#{paisController.writable}"
                                         action="#{paisController.delete(paisController.pais,true)}"
                                         update=":form:msg, :form"/>
                    </p:column>
                    <p:column>
                        <p:commandButton value="list" action="#{paisController.prepareGoList()}" immediate="true"/>
                    </p:column>

                </p:row>



            </h:form>

        </h:body>

    </f:view>
</html>