0

Basically what I have is a list called "mep", I display its values with commandlink and all i want is once you select a link to assign its value to my bean property "selectMep", the display part works pretty well and I'm struggling with the assignment part as I get an error which says that a String (the type of my bean property) cannot be casted to a UIcomponent, here's my code:

<ui:repeat var="mep" value="#{helloBean.mep}" >
            <tr>
                <td>#{mep}</td> 
                <h:commandLink value = "#{mep}"  action="" binding="#{helloBean.selectMep}"/>  
            </tr> <br></br>     
</ui:repeat>

Any suggestions?

Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102
KamyKam
  • 3
  • 3

1 Answers1

0

I would suggest to use the action of the commandLink, like this:

<h:commandLink value="#{mep}" action="#{helloBean.selectMep(mep)}" />

And add a new method to your bean:

public void selectMep(String val) {
    System.out.println(val);
}
mikereem
  • 235
  • 1
  • 14