2015-01-15 2 views
0

작업 수신기 메서드에서 클릭 된 단추 ID를 얻으려고합니다. 가능 ID를 얻기 위해 얼마나actionListener 메서드에서 클릭 된 p : commandButton 확인

public void UserActionListener (ActionEvent e) { 
    System.out.println("the button id"); 
} 

: 이것은 클릭 된 버튼의 ID를 취득하고자하는 이벤트 처리에 대한 내 기능

<p:commandButton id="submitButton" value="Delete" action="#{student.xxx()}" 
       actionListener="#{student.UserActionListener(e)}"/> 

입니다 :

이 내 XHTML 코드 액션 리스너 메소드의 제출 버튼?

답변

1

사용 e.getComponent()

....... 
import javax.faces.event.ActionEvent; 

public class ........{ 

    public String buttonId; 

    public void UserActionListener (ActionEvent e) { 
     System.out.println(e.getComponent().getClientId()); 

    } 
} 
+0

내가이 자동 나는 그가'("ID")를 얻을' – Gtopuria

+0

를 얻을 수 whant 때문에 생성됩니다 버튼 ID를 잘 모릅니다 @ 실제로 gknicker에는 getComponent() 메서드가 없으므로 놓친 것이 있습니까? – gknicker

+0

말을 의미 ID로 버튼 이름 – Gtopuria

관련 문제