0

I'm currently working on a project using facelets and JSP
but i was unable to find native jsp (xhtml) templates so i went for the second option which is try to convert a html template to xhtml
But i don't exactly know how to convert outputs and outputs, for instance i have successfully converter simple text input with the help of Pass-Through Elements.
now i try to display a list in a table but i seems unable to do it
i tried using dataTable like this

<h:panelGroup columns="2">
            <h:form>
                <h:dataTable value="#{loginBean.users}" var="employe"
                    border="1">
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Login" />
                        </f:facet>
                        <h:outputText value="#{employe.email}" />
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Prenom" />
                        </f:facet>
                        <h:outputText value="#{employe.username}" />
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Nom" />
                        </f:facet>
                        <h:outputText value="#{employe.idUser}" />
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Role" />
                        </f:facet>
                        <h:outputText value="#{employe.role}" />
                    </h:column>

                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Action" />
                        </f:facet>
                        <h:commandButton action="#{loginBean.removeEmploye(employe.id)}"
                            value="Supprimer" />
                        <h:commandButton action="#{loginBean.displayEmploye(employe)}"
                            value="Afficher" />
                    </h:column>
                </h:dataTable>
            </h:form>
        </h:panelGroup>

in the place of table tag but to no avail
also i tried using the <ui:repeat value="#{loginBean.users}" var="user"> loop like this

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"
                                  xmlns:f="http://xmlns.jcp.org/jsf/core"
                                  xmlns:h="http://xmlns.jcp.org/jsf/html"
                                  xmlns:p="http://xmlns.jcp.org/jsf/passthrough"
                                  xmlns:ui="http://java.sun.com/jsf/facelets"
                                  xmlns:jsf="http://xmlns.jcp.org/jsf">
                                   ...
                                    <table class="table tablesorter " id="">
                                        <thead class=" text-primary">

                                            <tr>

                                                <th>Name</th>

                                                <th>Country</th>

                                                <th>City</th>

                                                <th class="text-center">Salary</th>
                                            </tr>
                                        </thead>

                                        <tbody>
                                        <ui:repeat value="#{loginBean.users}" var="user">
                                            <tr>

                                                <td><ui:out value="#{user.username}"/></td>

                                                <td><ui:out value="#{user.email}"/></td>

                                                <td><ui:out value="rolii"/></td>

                                                <td class="text-center">$36,738</td>
                                            </tr>

                                            </ui:repeat>
                                        </tbody>
                                    </table>
                                  ...

but also not working. what i can see is that the function loginBean.users is not even being called. any ideas how to make it work ? i'll be happy to give any needed details

Ps. when i open the source code the <ui:repeat value="#{loginBean.users}" var="user"> is visible there

  • so you tried to view the client-side source and saw a `ui:repeat` there. And please try to chge the title to reflect the technical issue, not the broad(er) goal – Kukeltje Apr 17 '20 at 20:56
  • @Kukeltje yes when show the source the `ui:repeat` is there even with the `dataTable` it's just there doesn't execute – Bouhdida Abderrahim Apr 17 '20 at 21:08

0 Answers0