简体   繁体   English

如何在JSF组件中显示预览文本?

[英]How to show previewtext in JSF components?

Is it possible to show previewtext in JSF 1.2 components, for example in inputfields, selectmenue or in outputtext and the preview text disappears, if the user clicks into one of these components? 如果用户单击其中的一个组件,是否可以在JSF 1.2组件中显示预览文本,例如在输入字段,选择菜单或输出文本中显示预览文本,并且预览文本消失?

I saw that the attribute defaultLabel can be used in Rich faces for example? 我看到属性defaultLabel例如可以在Rich面孔中使用吗? Does JSF component have a similar attribute? JSF组件是否具有类似的属性?

Thanks & Greetz Marwief 谢谢&Greetz Marwief

If you mean to use placeholders , you can look for Primefaces watermark or RichFaces placeholder 如果您打算使用占位符 ,则可以查找Primefaces 水印或RichFaces 占位符

another way to go : take a look at passthrough with JSF2.2 另一种可供选择的方法:看看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"/>
 ...

that will be rendered as : 将呈现为:

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

but beware , this is HTML5 但请注意 ,这是HTML5

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM