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
Jsf 在ui:composition中包含cc:attribute的目标p:remoteCommand_Jsf_Primefaces_Facelets - Fatal编程技术网

Jsf 在ui:composition中包含cc:attribute的目标p:remoteCommand

Jsf 在ui:composition中包含cc:attribute的目标p:remoteCommand,jsf,primefaces,facelets,Jsf,Primefaces,Facelets,我尝试用ui:composition构建自己的JSF组件。当我使用一个以remoteCommand(Primefaces)为目标的action属性时,我遇到了一些问题:只要我对h:form中该组件的所有元素使用action属性,我的代码似乎就可以工作。但是,当我只对某些元素使用action属性时,我的bean的方法永远不会对任何元素调用 这是我的代码: 一, 二, 前面的代码不起作用!当我单击第一个输入字段时,我的bean方法不会执行 但是,当我在第二个输入字段中包含action属性时,

我尝试用ui:composition构建自己的JSF组件。当我使用一个以remoteCommand(Primefaces)为目标的action属性时,我遇到了一些问题:只要我对h:form中该组件的所有元素使用action属性,我的代码似乎就可以工作。但是,当我只对某些元素使用action属性时,我的bean的方法永远不会对任何元素调用

这是我的代码:

一,


二,


前面的代码不起作用!当我单击第一个输入字段时,我的bean方法不会执行

但是,当我在第二个输入字段中包含action属性时,将执行我的bean方法:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html   xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://xmlns.jcp.org/jsf/html"
        xmlns:p="http://primefaces.org/ui"
        xmlns:mycomponent="http://java.sun.com/jsf/composite/composites">
<h:head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <h:outputStylesheet library="styles" name="ownContainers.css"  />
</h:head>
<h:body>
    <h:form> 
        <mycomponent:input action="#{testBean.test()}" />
        <mycomponent:input action="#{testBean.test()}" />
    </h:form>
</h:body>
</html>


当我只需要某些元素的action属性而不需要其他元素的action属性时,我该怎么办?为什么第一个例子不起作用

我很难理解你的问题。愿意为那件事道歉吗!当我总是将mycomponent:input与action属性一起使用时,我的代码是有效的,就像这样:但是,当我只对我的一些元素使用action属性时,对于我有action属性的元素也不会调用该方法。你的最后一句话让我很难再次理解。。。什么是“仅使用动作属性”,什么是“某些元素”?请您可以编辑您的问题并在其中添加“新”代码。。。谢谢你!我添加了一些信息,希望您现在能理解我的问题。我很难理解您的问题。愿意为那件事道歉吗!当我总是将mycomponent:input与action属性一起使用时,我的代码是有效的,就像这样:但是,当我只对我的一些元素使用action属性时,对于我有action属性的元素也不会调用该方法。你的最后一句话让我很难再次理解。。。什么是“仅使用动作属性”,什么是“某些元素”?请您可以编辑您的问题并在其中添加“新”代码。。。谢谢你!我添加了一些信息,希望您现在能理解我的问题。
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html   xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://xmlns.jcp.org/jsf/html"
        xmlns:p="http://primefaces.org/ui"
        xmlns:mycomponent="http://java.sun.com/jsf/composite/composites">
<h:head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <h:outputStylesheet library="styles" name="ownContainers.css"  />
</h:head>
<h:body>
    <h:form> 
        <mycomponent:input action="#{testBean.test()}" />
        <mycomponent:input />
    </h:form>
</h:body>
</html>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html   xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://xmlns.jcp.org/jsf/html"
        xmlns:p="http://primefaces.org/ui"
        xmlns:mycomponent="http://java.sun.com/jsf/composite/composites">
<h:head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <h:outputStylesheet library="styles" name="ownContainers.css"  />
</h:head>
<h:body>
    <h:form> 
        <mycomponent:input action="#{testBean.test()}" />
        <mycomponent:input action="#{testBean.test()}" />
    </h:form>
</h:body>
</html>