我已將primefaces-3.4RC1.jar
包含在WEB-INF/lib
目錄中。在我的控制器即時自動裝配我的模型豆狀PrimeFaces 3.4 RC1,對話框無法識別託管Bean屬性
@ManagedBean
@RequestScoped
public class MyController{
@Autowired
Location loc;
//other stuff
}
我Location
類看起來像
public class Location{
private Integer countryId;
//getters setters
}
我的觀點看起來像
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition 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:p="http://primefaces.org/ui">
<div class="contentBox cornerBorder border">
<p:dialog>
<table class="DialogTable">
<tr>
<td><label>Country</label></td>
<h:selectOneMenu required="true" id="contry" styleClass="text-box" value="#{myController.loc.countryId}">
----------------------------------------------------------------------------------------------^here it gives warning and if i run it crashes
</tr>
</table>
</p:dialog>
當我點擊一個鏈接,打開的對話框中,它拋出一個錯誤,該屬性countryId
找不到。如果我刪除value="myController.loc.countryId"
運行它確定... 任何人來指導我在正確的方向
PS:我已經在應用程序的context.xml做出相應的條目
實際的錯誤
重度:javax.el.PropertyNotFoundException: /WebPages/personal/personalDiv.xhtml @ 230119 值= 「#{myController.loc.countryId}」:類 「com.deltasoft.controller.myCo ntroller'沒有 'loc'屬性。
我認爲你需要用@ManagedBean和一些範圍註釋myController的,那麼你就需要一個getter for loc –
@AkselWillgert我編輯了這個問題來添加更多細節我已經用託管bean註釋了控制器並定義了範圍 – dakait
但是你確實有get之三?還有一個錯字,我認爲:countryID vs countryId? –