当我创建一个包含构面的复合组件并将命令链接放置在该构面中时,出现错误消息: This link is disabled as it is not nested within a JSF form.
commandButton的行为方式不同,所以我倾向于这是一个错误。
index.xhtml:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:mycomp="http://xmlns.jcp.org/jsf/composite/mycomp"
xmlns:f="http://xmlns.jcp.org/jsf/core">
<h:head>
</h:head>
<h:body>
<mycomp:component>
<f:facet name="someFacet">
<h:commandLink value="this link should work, but does not (within form, within facet)"/><br/>
<h:commandButton value="this button works as expected (within form, within facet)"/><br/>
</f:facet>
</mycomp:component>
</h:body>
</html>
Run Code Online (Sandbox Code Playgroud)
/resources/mycomp/component.xhtml:
<?xml version='1.0' encoding='UTF-8' ?>
<ui:component
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:cc="http://xmlns.jcp.org/jsf/composite"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:a="http://xmlns.jcp.org/jsf/passthrough"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
>
<cc:interface>
<cc:facet …Run Code Online (Sandbox Code Playgroud)