0

I just learnt about the State pattern . I would like to know where in core Java / JSF/Servlets code s can I see this pattern being implemented ? I want to see how the state transition is implemented and who plays the role of states and who plays the role of context there ?

jaco0646
  • 15,303
  • 7
  • 59
  • 83
Geek
  • 26,489
  • 43
  • 149
  • 227
  • Related: http://stackoverflow.com/questions/1673841/examples-of-gof-design-patterns/2707195#2707195 – BalusC Jan 21 '13 at 11:10

1 Answers1

3

In JSF it can be lifecycle processing. Phase is a state with concrete states: ApplyRequestValuesPhase, InvokeApplicationPhase, ProcessValidationsPhase, RenderResponsePhase, RestoreViewPhase, UpdateModelValuesPhase. Context would be Lifecycle.

NOTE: This example is from Mojarra implementation of JSF.

partlov
  • 13,789
  • 6
  • 63
  • 82
  • 2
    Note that the mentioned `Phase` implementations are Mojarra (`com.sun.faces.*`) specific. MyFaces (`org.apache.myfaces.*`) gave them different names. – BalusC Jan 21 '13 at 11:11