How to use <f:setPropertyActionListener> with Passthrough Elements in JSF 2?

Asked

Viewed 3,098 times

1

I am using Passthrough elements in my JSF project, and I need to do something similar to this:

<h:commandLink action="#{meuBean.acao()}" value="clique aqui">
    <f:setPropertyActionListener target="#{meuBean.objeto}" value="#{objetoLocal}"/>
</h:commandLink>

but using Passthrough elements to have greater control of my frontend, as in the attempt below:

<a href="#" jsf:action="#{meuBean.acao()}">clique aqui
    <f:setPropertyActionListener target="#{meuBean.objeto}" value="#{objetoLocal}"/>
</a>

but apparently this is not working, I get the following error message:

<f:setPropertyActionListener> Parent is not of type ActionSource, type is: com.sun.faces.component.PassthroughElement

Does anyone know how I could solve this?

3 answers

1


0

Try this:

    <a href="#" jsf:id="linkAction" jsf:action="#{meuBean.acao()}">clique aqui</a>
    <f:setPropertyActionListener target="#{meuBean.objeto}" value="#{objetoLocal}" for="linkAction"/>

-1

So the error that is happening is simple, it speaks that the html tag <a> does not recognize the tag jsf:action, because this is associated with an element of the type button and not to a ancor.

Try to use <a type="bytton"> or use the <button jsf:action> which is equivalent to h:commandButton jsf.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.