Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have refactored your code. Here is the UkrCity Class.</p> <pre><code>package com.example; import java.io.Serializable; public class UkrCity implements Serializable { /** * */ private static final long serialVersionUID = 1L; private String name; public UkrCity(String name) { this.setName(name); } public String getName() { return name; } public void setName(String name) { this.name = name; } } </code></pre> <p>Here is the backing bean</p> <pre><code>package com.example; import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; @ManagedBean @SessionScoped public class TableBean implements Serializable{ /** * */ private static final long serialVersionUID = 1L; private ArrayList&lt;UkrCity&gt; cities = new ArrayList&lt;UkrCity&gt;(Arrays.asList(new UkrCity("Київ"),new UkrCity("Харків") )); public ArrayList&lt;UkrCity&gt; getCities() { return cities; } } </code></pre> <p>Here is your index.xhtml</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"&gt; &lt;h:head&gt; &lt;title&gt;UkrCities Table&lt;/title&gt; &lt;/h:head&gt; &lt;h:body&gt; &lt;h:form&gt; &lt;h:dataTable value="#{tableBean.cities}" var="city"&gt; &lt;h:column&gt; &lt;f:facet name="header"&gt;City&lt;/f:facet&gt; &lt;h:outputText value="#{city.name}" /&gt; &lt;/h:column&gt; &lt;h:column&gt; &lt;f:facet name="header"&gt;School&lt;/f:facet&gt; &lt;h:inputText value="" /&gt; &lt;/h:column&gt; &lt;h:column&gt; &lt;f:facet name="header"&gt;Add/Remove&lt;/f:facet&gt; &lt;h:selcectBooleanCheckbox value="" onclick="submit()" /&gt; &lt;/h:column&gt; &lt;/h:dataTable&gt; &lt;/h:form&gt; &lt;/h:body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload