this is my first post here and my first baby steps with primeface, so please let me know if I have missed any important things.
I try to learn Primefaces and build a simple Ui for the beginning - I use Primefaces 3.3 and jsf 2.1.11 and jstl 1.2
I have the two following bean classes
Code: Select all
public class Player {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
Code: Select all
public class Achievement {
private String title;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}
Code: Select all
@ManagedBean(name = "achievements")
public class AchievementService {
private final Set<Achievement> achievements = new HashSet<>();
@PostConstruct
public void init() {
final Achievement ac = new Achievement();
ac.setTitle("Achievement Hurray");
achievements.add(ac);
}
public Set<Achievement> getAchievements() {
return achievements;
}
}
Code: Select all
@ManagedBean(name = "players")
public class PlayerService {
private final List<Player> players = new ArrayList<>();
@PostConstruct
public void init() {
final Player e = new Player();
e.setName("dbac");
players.add(e);
}
public List<Player> getPlayers() {
return players;
}
}
Code: Select all
<h:body>
<h:form>
<p:tabView dynamic="true" cache="true">
<p:tab title="Players">
<h:panelGrid columns="2" cellpadding="10">
<p:dataTable var="player" value="#{players.players}">
<p:column headerText="Name">
<h:outputText value="#{player.name}" />
</p:column>
</p:dataTable>
<p:dataTable var="ac" value="#{achievements.achievements}">
<p:column headerText="Title">
<h:outputText value="#{ac.title}" />
</p:column>
</p:dataTable>
</h:panelGrid>
</p:tab>
</p:tabView>
</h:form>
</h:body>
/index.xhtml @24,44 value="#{ac.title}": Property 'title' not found on type java.util.Collections$UnmodifiableSet
when I comment the second dataTable out, it works. If I comment out the first dataTable, it is again not working.
Why is the second "Achievement" not working, what do I miss ? I have the feeling its a minor thing and I'm simply blind
Thanks for any hints