名單
<h:selectOneMenu id="playerMenu" value="#{player.combinedName}">
<f:selectItems value="#{serviceHCP.allPlayers}" />
<f:ajax execute="playerMenu" render="playerMenu" />
選擇另一個名稱。如果我用上面的方法我會永遠結束UPP與玩家更新== NULL
如果我沒有使用f:ajax,我將永遠以相同的「玩家」結束。但我當然想要在菜單項中選擇一個。
我會然後把它傳給一個bean
<h:commandButton value="Visa lista" action="#{serviceSeries.getSeriesForPlayerInfo(club.name, player, serieType.serie_type, calendarBean) }">
</h:commandButton>
public List<Player> getAllPlayers() {
if (factory == null) {
factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
}
EntityManager em = factory.createEntityManager();
//Order by the matchdate.
//Query q = em.createQuery("select t from DBTest t");
Query q = em.createQuery("select t from Player t");
List<Player> players = q.getResultList();
for (Player aPlayer : players) {
System.out.println(aPlayer);
}
System.out.println("Size: " + players.size());
em.close();
return players;
}
如果我必須將它轉換爲字符串不會它只是使用eaiser。作爲局部變量。是否也可以使用valueChangeListerner做到這一點? –
user2130951