问题
Hi suppose you have the following composite component:
<!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:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core" xmlns:composite="http://java.sun.com/jsf/composite"
>
<composite:interface>
<composite:attribute name="action" targets="#{cc.clientId}:value"/>
</composite:interface>
<composite:implementation>
<h1>clientId is: #{cc.clientId}</h1>
<h:commandButton id="value" action="null" value="submit"/>
</composite:implementation>
</html>
This composite component simply prints out the clientId now if I use this composite component as follows:
<h:form id="formID">
<wui:test id="testID"/>
</h:form>
What I would expect to have as a result is:
clientId is: formID:testID
BUT what I really get is:
clientId is: testID
Now if I click on the button the form will be submitted and now the result is:
clientId is: formID:testID
What is causing the problem is the action attribute in the composite interface, if I remove it then the id is always formID::testID
Am I missing something?
Update:
I am using Mojarra javax.faces-2.1.4.jar
Update:
I created an issue for the Mojarra team: http://java.net/jira/browse/JAVASERVERFACES-2278
来源:https://stackoverflow.com/questions/8706376/inconsistent-composite-component-clientid-when-using-a-methodexpression-attribut