2013-10-22 36 views
0

是否有可能在JSF 1.2組件中顯示previewtext,例如在inputfields,selectmenue或outputtext中,並且如果用戶點擊其中一個組件,預覽文本就會消失?如何在JSF組件中顯示previewtext?

我看到屬性defaultLabel可以用在Rich faces中嗎? JSF組件是否有類似的屬性?

感謝&格爾茨 Marwief

+0

我已經使用例如標籤屬性 – Marwief

回答

1

如果你的意思是使用佔位符,你可以看看Primefaces watermark或RichFaces的placeholder

另一種方式去:看看直通與JSF2.2

<html xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:h="http://xmlns.jcp.org/jsf/html" 
    xmlns:f="http://xmlns.jcp.org/jsf/core" 
    xmlns:p="http://xmlns.jcp.org/jsf/passthrough"> 

<h:inputText value="#{item.name}" p:placeholder="my item"/> 
... 

將被渲染爲:

<input type="text" ... placeholder="my item"> 

但要注意,這是HTML5