0

I am getting started with JSF and I tried to do the following:

I have a Service that contains of a list of films:

@Named
@RequestScoped
public class FilmListView {

    @Inject
    FilmService filmService;

    private List<Film> filmList = new ArrayList<Film>();

    public FilmListView() { }

    /**
     * Loads all films upon starting - empty list if database is empty
     */
    public  void onload(){
        this.filmList = filmService.readAll();
        addMockupData();
    }

    private void addMockupData() {
        Film film = new Film();
        film.setTitle("MockupTitle");
        film.setDescription("MockupDescr.");
        film.setReleaseyear((short) 1997);
        this.filmList.add(film);
    }
}

And a view that is supposed to print these items in a list:

<h:dataTable value="#{filmListView.filmList}" var="film">
    <h:column>
        <f:facet name="header">Filmname</f:facet>
        #{film.title}
    </h:column>
    <h:column>
        <f:facet name="header">Schauspieler</f:facet>
        #{film.description}
    </h:column>
    <h:column>
        <f:facet name="header">Jahr</f:facet>
        #{film.releaseyear}
    </h:column>
</h:dataTable>

just according to this documentation.

Sadly this results in:

enter image description here

So there seems to be an issue with the translation. I am not getting any error or something else. What did I do wrong?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Rüdiger
  • 893
  • 5
  • 27
  • 56
  • Try to add implements Serializable and check any difference.. Also try add getter for filmList – 10101101 Mar 11 '20 at 17:27
  • So if you drop the datatable and just put `#{filmListView.filmList}` in there instead, it **IS** evaluated? – Kukeltje Mar 11 '20 at 19:42
  • 2
    And please check http://jsf.zeef.com for good tutorials. The one you use is old and not the best in many other ways too. – Kukeltje Mar 11 '20 at 22:09

0 Answers0