@ManagedBean(name = "findMB")
@RequestScoped
public class FindMB {
@ManagedProperty(value="#{selfMB}")
private SelfMB selfMB;
private String findBy = "FirstNameAndLastName";
private String email;
private List<User> found;
private Invite invite;
@EJB
private InviteBeanLocal inviteBean;
public FindMB() {
}
public SelfMB getSelfMB() {
return selfMB;
}
public void setSelfMB(SelfMB selfMB) {
this.selfMB = selfMB;
}
protected InviteBeanLocal getInviteBean() {
return inviteBean;
}
public void createInvite(User other) {
System.out.println("XXXXXXXXXXXXXXXXXXXXX QUERO EXECUTAR UM CÓDIGO AQUI XXXXXXXXXXXXXXXXXX");
}
public List<User> getFound() {
if (found == null) {
found = new ArrayList<User>();
}
return found;
}
public Invite getInvite() {
return invite;
}
}
<h:form prependId="false">
<div class="line_botton">
<h2><h:outputText value="#{bundle.TextResult}"/></h2>
<h:panelGroup id="result">
<h:dataTable value="#{findMB.found}" var="user" styleClass="result_find" columnClasses="result_find_column1,result_find_column2,result_find_column3,result_find_column4">
<h:column>
<div class="superPhotoSmall">
<div class="subPhotoSmall">
<h:graphicImage alt="#{bundle.TextPhotoProfile}" url="#{user.photoProfile}" rendered="#{user.showPhotoProfile}" styleClass="photoProfileSmall"/>
<h:graphicImage alt="#{bundle.TextPhotoProfile}" url="#{resource['image:male.jpg']}" rendered="#{user.showPhotoMale}" styleClass="photoProfileSmall"/>
<h:graphicImage alt="#{bundle.TextPhotoProfile}" url="#{resource['image:female.jpg']}" rendered="#{user.showPhotoFemale}" styleClass="photoProfileSmall"/>
</div>
</div>
</h:column>
<h:column>
<h:outputText value="#{user.firstName} #{user.lastName}"/>
</h:column>
<h:column>
<p:inplace label="#{bundle.TextWriteAPersonalMessage}">
<h:inputTextarea value="#{findMB.invite.message}" cols="40" rows="2" onkeydown="textCounter(this.value,this,200);" onblur="textCounter(this.value,this,200);" styleClass="inputTextArea"/>
</p:inplace>
</h:column>
<h:column>
<h:commandButton title="#{bundle.TextAddAsFriend}" image="#{resource['image:add-friend.png']}" styleClass="icon">
<f:ajax event="click" listener="#{findMB.createInvite(user)}"/>
</h:commandButton>
</h:column>
</h:dataTable>
</h:panelGroup>
<div>
<h2 align="center">
<h:commandLink value="Ver mais">
</h:commandLink>
</h2>
</div>
</div>
</h:form>
****Tirei alguns trechos de código que acredito são serem relevantes…
Clico no botão e nao chama o método, só chama o construtor do FindMB ???
Alguém pode dar um Help???