0

I am new to Java. I have following doubt.

When to use ActionListener and when Action? And which one gets executed first?

Can someone explain in simple steps?

Roman C
  • 49,761
  • 33
  • 66
  • 176
Sri Sri
  • 11
  • 2
    @JunedAhsan What if everybody at this site would refer people to google? – Joetjah Aug 13 '13 at 08:59
  • Dublicatet you find your answer here: http://stackoverflow.com/questions/3909267/differences-between-action-and-actionlistener – Gerret Aug 13 '13 at 09:01

1 Answers1

0

If you are using actionListener and action in jsf, then actionListener gets executed first.

Prasad Kharkar
  • 13,410
  • 5
  • 37
  • 56
  • Not a comment to this answer really, but why did you add the tag `jsf`? – Joetjah Aug 13 '13 at 09:01
  • because I am sure actionlistener and action method order execution. and all the answers refer to JSF only. – Prasad Kharkar Aug 13 '13 at 09:03
  • I could be wrong but I don't think this is limited to JSF? What about Swing? – Joetjah Aug 13 '13 at 09:05
  • I don't know about swing, but I was sure about JSF. – Prasad Kharkar Aug 13 '13 at 09:06
  • That's allright then. JSF is indeed included but I was thinking to keep this question more general. Doesn't matter too much though, do as you like :) – Joetjah Aug 13 '13 at 09:09
  • Thats fine :) Even I could be wrong :) Good that you kept generalized. – Prasad Kharkar Aug 13 '13 at 09:10
  • @Joetjah As Swing's `Action` extends `ActionListener`, asking which gets called first wouldn't begin to make sense if the OP meant Swing. Ergo he didn't. Conflating two completely different things doesn't constitute keeping things general, it just constitutes introducing confusion. – user207421 Aug 13 '13 at 10:41