h:inputText - jsf不呈现占位符 [英] h:inputText - jsf does not render the placeholder

查看:617
本文介绍了h:inputText - jsf不呈现占位符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要创建一个landingpage,并且要通过jsf 2.0和Primefaces 3.5将数据保存在我的数据库中

I want to create a landingPage and I want to save the data in my database through jsf 2.0 and Primefaces 3.5

我的页面* .xhtml页面看起来像这样:

My page *.xhtml page looks like this:

>

但是,我想让它看起来像我的HTML页面:

However, I want to make it look like my HTML page:

除了CSS我的h:inputText应该包含一个占位符。我的代码如下所示:

Besides the CSS my h:inputText should contain a placeholder. My code looks like this:

<h:form class="homepage_invitee_form" action="" method="POST">
    <h:inputText name="email" placeholder="Email Address"
                 id="email_address_new" type="text placeholder" />
    <br />
    <h:inputText name="firstName" placeholder="First Name"
                 id="firstname_new" type="text placeholder" />
    <h:inputText name="lastName" placeholder="Last Name"
                 id="lastname_new" type="text placeholder" />
    <br />
    <h:button value="Request Invitation" type="submit" class="btn btn-primary opal_btn"
              id="submit_form_new" />
</h:form>

正如您所看到的,placeholder属性不会被渲染。

As you can see the placeholder attribute doesn't get rendered. I would really appreciate any idea as to how to render that properly.

UPDATE

我的HTML代码如下所示:

My HTML code looks like this:

<form class="homepage_invitee_form" action="" method="POST">
    <input name="email" placeholder="Email Address" id="email_address_new" type="text placeholder"><br>
    <input name="firstName" placeholder="First Name" id="firstname_new" type="text placeholder">
    <input name="lastName" placeholder="Last Name" id="lastname_new" type="text placeholder"><br> 
    <button type="submit" class="btn btn-primary opal_btn" id="submit_form_new">Request Invitation</button>
</form>


推荐答案

使用 p:在xhtml中,而不是您的占位符。其他视觉设计完全关于你的CSS。

Use p:watermark in xhtml instead of your placeholders. Other visual design is totally about your css.

这里看一下这个 primefaces showcase

这篇关于h:inputText - jsf不呈现占位符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆