Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf Richfaces占位符不工作_Jsf_Jsf 2_Richfaces - Fatal编程技术网

Jsf Richfaces占位符不工作

Jsf Richfaces占位符不工作,jsf,jsf-2,richfaces,Jsf,Jsf 2,Richfaces,我正在使用JSF2.0,并尝试使用RichFaces4.3的占位符。下面是jsf代码 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:c="http:/

我正在使用JSF2.0,并尝试使用RichFaces4.3的占位符。下面是jsf代码

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:c="http://java.sun.com/jstl/core"
      xmlns:rich="http://richfaces.org/rich">
....
....
<h:form>
    <table>
        <thead>
            <tr>
                <th>
                    <h:outputText value="Header"/>
                </th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>
                    <h:inputText id="first" value="#{bean.firstValue}">
                        <rich:placeholder value="Fill me"/>
                    </h:inputText>
                </td>
            </tr>
        </tbody>
    </table>
</h:form>

....
....
这就是它的呈现方式:

<form id="j_id_1v" name="j_id_1v" method="post" action"/mypage/app/main.xhtml" enctype="application/x-www-form-urlencoded">
<table>
    <thead>
        <tr>
            <th>
                "Header"
            </th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>
                <span id="j_id_1v:j_id_2r">
                    <script id="j_id_1v:j_id_2rScript" type="text/javascript">
                        <!--
                        new RichFaces.ui.Placeholder("j_id_1v:j_id_2r", {"targetId":"j_id_1v:first","text":"Fill me"} );
                        //-->
                    </script>
                </span>
                <input id="j_id_1v:first" name="j_id_1v:first" type="text" value>
            </td>
        </tr>
    </tbody>
</table>
</form>

“标题”
#{bean.firstValue}”为空,不是空字符串。不确定这是否重要。问题是占位符文本没有显示

有什么想法吗

--编辑--
检查js控制台时,会显示“Richfaces未定义“。我肯定我用的是richfaces 4.3

好吧,我做了大量的研究后才发现。如果您使用
,那么JSF2.0和richfaces就无法相处。您必须使用
,以便它插入所有必需的依赖项。而且。。。就这样

对我来说,在inputText中添加了ajax支持,例如

<h:inputText id="first" value="#{bean.firstValue}">
    <rich:placeholder value="Fill me"/>
    <a4j:ajax/>
</h:inputText>


我工作的地方有自己的maven存储库。我可以访问richfaces,但没有primefaces。所以我不能添加新内容,只能使用他们回购协议中的内容。好吧,那就别提之前的评论了。没问题。我注意到渲染的richfaces被包裹。我从未见过这样的例子。我不确定这是不是把我的东西搞砸了,但这很奇怪/这没有害处。这只是为了防止不支持
元素的史前网络浏览器阻塞,比如Netscape 1.0。现在为什么在HTML代码中看到这一点确实令人怀疑。这些浏览器已经有近十年没有使用了。RichFaces只是有点过分热衷于试图实现最大的浏览器兼容性。。。不过,我还是不明白占位符到底是怎么回事。css样式可能会干扰占位符吗?