april26
april26

Reputation: 843

Why is my rich:dataTable not rendering?

I can not figure out why my rich:dataTable is not rendering. I am using JSF 2 and Richfaces 4. URL is http://localhost:8080/contacts-as7/me2.jsf?sitecode=0Z56, but it behaves the same without the sitecode parameter.

Here is the view

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:rich="http://richfaces.org/rich"
  xmlns:a4j="http://richfaces.org/a4j">

<h:head>
  <title>contacts</title>
</h:head>

<f:metadata>
  <f:viewParam name="sitecode" value="#{contactView.siteCode}" />
  <f:event listener="#{contactView.retrieve056}" type="preRenderView"></f:event>
</f:metadata>

<h:form>
  <h:messages />

  <rich:panel rendered="#{not empty contactView.doors}">
    <f:facet name="header">
      <h:outputText value="Site Code #{contactView.doors.siteCode}" />
    </f:facet>
    <h:panelGrid columns="1">
      <h:outputText
        value="Report corrections to your DOORS administrator" />
      <h:outputText id="nm1" value="#{contactView.doors.name}" />
      <h:outputText id="pgr1" value="#{contactView.doors.pager}" />
      <h:outputText id="adr1" value="#{contactView.doors.addr1}" />
      <h:outputText id="adr2" value="#{contactView.doors.addr2}"
        rendered="#{not empty contactView.doors.addr2}" />
      <h:outputText id="csz"
        value="#{contactView.doors.city}, #{contactView.doors.state} #{contactView.doors.zip}" />
    </h:panelGrid>
  </rich:panel>

  <rich:dataTable value="#{contactView.doors.alternateList}" var="_xyz">
    <h:panelGrid columns="1">
      <h:outputText id="nm11" value="#{_xyz.name}" />
      <h:outputText id="pgr11" value="#{_xyz.phone}" />
      <h:outputText id="adr11" value="#{_xyz.pager}" />
      <h:outputText id="adr21" value="#{_xyz.comment}" />
    </h:panelGrid>
  </rich:dataTable>

</h:form>

</html>

Here is my view bean

@Named
@ViewScoped
public class ContactView implements Serializable {

    public ContactView() {
    }

    @EJB
    ContactService contactService;

    private String siteCode;
    private Doors doors;
    private AlternateContact alternateContact;


    public String retrieve056() {
        System.out.println("RETRIEVE");
        this.doors = this.contactService.findDoors("0Z56");
        System.out.println("doors_id is "+ doors.getDoorsId());
        for ( AlternateContact alt : doors.getAlternateList() ){
            System.out.println("alt name "+ alt.getName());
        }
        return "me2.jsf?sitecode=0Z56&faces-redirect=true";
    }

}

And here is the output on the console -- the doors.getAlternateList() is definitely populated.

15:30:58,382 INFO  [stdout] (http-localhost-127.0.0.1-8080-3) alt name Thomas Cahill

15:30:58,392 INFO  [stdout] (http-localhost-127.0.0.1-8080-3) alt name Micahel Henry

And yet it doesn't show up on my view! I have been looking at this all day and am desparate. Any ideas? It was working at some point in the last few days, but I have no idea how I broke it as I was working on other things.

TDR

Upvotes: 0

Views: 2765

Answers (2)

Smart Coder
Smart Coder

Reputation: 1738

Did you include the all the commons*.jar that goes with richfaces? Without that it won't render.

Upvotes: 0

FMQ
FMQ

Reputation: 418

When using dataTable you should use rich:column or rich:columnGroup

Try using <rich:dataGrid> instead of <rich:dataTable>

Just look at rich:dataGrid...

Regards

Upvotes: 1

Related Questions