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

1

I'm 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 more 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?

    
asked by anonymous 14.12.2015 / 21:11

3 answers

1

You must be using some prefix to use JSF commands.

There are two other ways to generate the <a> anchor tag, the first one is with <h:outputLink><\h:outputLink> and the second is with <h:link />

If what you are looking for is the attributes, see the equivalents of each tag and use, it is likely to have more than the <a> tag itself, the difference is how it will be rendered.

link

link

    
15.12.2015 / 14:31
0

Try this:

    <a href="#" jsf:id="linkAction" jsf:action="#{meuBean.acao()}">clique aqui</a>
    <f:setPropertyActionListener target="#{meuBean.objeto}" value="#{objetoLocal}" for="linkAction"/>
    
30.01.2017 / 13:19
-1
So the error that is happening is simple, it says that the html tag <a> does not recognize the jsf:action tag because it is associated with an element of type button and not a ancor .

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

    
19.07.2016 / 21:25