JSF使用注意點
1.轉換時間時,必須加上時區GMT+8,不然相差一天。
<managed-bean-name>productBean</managed-bean-name>
<managed-bean-class>demo.view.ProductBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>id</property-name>
<property-class>java.lang.Integer</property-class>
<value>#{param.id}</value>
</managed-property>
<managed-property>
<property-name>view</property-name>
<property-class>java.lang.Boolean</property-class>
<value>#{param.view}</value>
</managed-property>
</managed-bean>
String someValue = params.get("id");
這個是按參數名稱查找的
{
if (FacesContext.getCurrentInstance().getRenderResponse())
return false;
else
return true;
}
感謝 tdwebber 提供。
1) When using a jsp:include within the f:view tags, must include f:subview in the included file (or around the jsp:include tag).
當在f:view中使用jsp:include標簽插入一個文件時,必須用f:subview把jsp:include包起來
2) In the include file, cannot have any HTML. All HTML tags must be wrapped in f:verbatim tags.
在被插入的文件中,不能有任何的html標簽,如果必須使用html標簽,必須用f:verbatim將它包起來。
3) Within main f:view tags however, it is not necessary to wrap everything in f:verbatim tags (it's not bad either). Just HTML that appears as children to other JSF components (i.e. t:newspaperTable).
在主f:view中,沒有必要用f:verbatim將html標簽包起來(當然包起來也可以)。當html標簽出現在子視圖或其它JSF部件標簽中時,就要用f:verbatim包起來。
10.JSF的緩存能力好像太強了,有時停止了服務器,改動了jsp頁面中的jsf標簽,再啟動服務器,但到該頁面時,還是原來的內容,需要手動刷新一下。有時需要先轉到別的頁面,再回來刷新一下才能看到更新的內容。