使用JBoss 6.0.0.Final,Richfaces 3.3.3.Final,MyFaces 2.0.6,facelets 1.1.15.B1(RF 3的限制)。如何將註釋與faces-config.xml混合
我在一個遺留項目中,其中包含數百個在faces-config.xml
中定義的bean。我想保留在faces-config.xml中定義的那些,但爲新的bean使用註釋。然而,當我嘗試過這個時,我還沒有成功。由註釋定義的豆,即
@ManagedBean
@ViewScoped
public class Foobar implements Serializable {
// ...
}
該bean無法從我的JSF頁面訪問。我相信我已經通過使用適當的頭文件在我的faces-config.xml中指定了2.0版本。
<faces-config
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
version="2.0">
我還需要在faces-config.xml
中做些什麼來允許註釋也被使用?
對不起,我應該指定我沒有試圖對同一個bean同時使用annotation和faces-config.xml配置。我想添加新的bean,而不必將舊的bean從使用faces-config.xml – user959690
我更新了答案。 – BalusC