As far as I know the @this is to denote the current component triggering the event, such as :
<p:commandButton process="@this" ... />
And in JSF 2 Ajax, the @this can also mean the encapsulating component, like :
<h:inputText ...>
<f:ajax execute="@this" ... />
</h:inputText>
And I have one case where using p:datatable, including or excluding @this can have a different impact upon Ajax partial submit
Here's the example, in this case, the process is using @this, and this works as expected, where when process happens first, and then followed by setPropertyActionListener and last, the action is executed :
<p:column>
<p:commandLink
value="#{anggaranDetail.map['code']}"
process="@this infoAnggaranForm:Anggaran"
update="detailDialogForm:Anggaran detailDialogForm:SubAnggaran"
oncomplete="infoAnggaranDialog.hide()"
image="ui-icon ui-icon-search"
action="#{tInputBean.updateAnggaranSubAnggaran}">
<f:setPropertyActionListener value="#{anggaranDetail}"
target="#{infoAnggaranBean.selectedAnggaranDetail}" />
</p:commandLink>
</p:column>
But when I omit the @this from this example, the setPropertyActionListener and the action are never executed, as if they're not there.
I wonder why ? Perhaps @this has some other meaning other than the current component, perhaps the current record in this example ?
Im using tomcat 7, and these are my dependencies :
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.0.4-b09</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.0.4-b09</version>
<scope>compile</scope>
</dependency>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…