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 commandLink仅适用于h和p版本_Jsf_Glassfish 4_Commandlink - Fatal编程技术网

Jsf commandLink仅适用于h和p版本

Jsf commandLink仅适用于h和p版本,jsf,glassfish-4,commandlink,Jsf,Glassfish 4,Commandlink,我遇到了一个非常奇怪的问题,我的commandLink只有在同一视图中有两个链接时才起作用 工作正常,两个链接: <ui:composition template="../../template.xhtml" xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:p=&qu

我遇到了一个非常奇怪的问题,我的
commandLink
只有在同一视图中有两个链接时才起作用

工作正常,两个链接:

<ui:composition template="../../template.xhtml" xmlns="http://www.w3.org/1999/xhtml"
            xmlns:h="http://xmlns.jcp.org/jsf/html"
            xmlns:p="http://primefaces.org/ui"
            xmlns:f="http://xmlns.jcp.org/jsf/core"
            xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
    <ui:define name="content">
        <h:form>
            <p:dataTable var="v" value="#{myBean.myList}">
                <p:column headerText="Name">
                    <h:commandLink value="Go to next page" action="#{myBean.doThing(v)}" />
                    <p:commandLink value="Go to next page" action="#{myBean.doThing(v)}" />
                </p:column>
            </p:dataTable>
            <p:commandButton value="Submit" ajax="false" actionListener="#{myBean.submit}" />
        </h:form>
    </ui:define>
</ui:composition>
我正在使用JSF2.0和GlassFish 4.0

我如何解决这个问题?为什么会发生

我在另一个视图中的
p:dataTable
中有一个
commandLink
,它工作正常

编辑: 为视图的组成部分添加了完整的XML。分部文件位于模板内:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
    <h:head>
        <!-- css imports, titles etc -->
    </h:head>
    <h:body>
        <ui:insert name="menu">
            <ui:include src="./default/content.xhtml" />
        </ui:insert>
    </h:body>
</html>


请添加完整的xhtml页面。是否还需要模板XML?请检查您的页面是否包含
h:form
?这些按钮是否在
h:form
中?另外,不应该有嵌套的
h:form
它是在一个h:form中,否则它就不能同时使用两个链接。很抱歉,我忘记将其添加到我的问题中。请添加您的xhtml完整页面
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
    <h:head>
        <!-- css imports, titles etc -->
    </h:head>
    <h:body>
        <ui:insert name="menu">
            <ui:include src="./default/content.xhtml" />
        </ui:insert>
    </h:body>
</html>