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>