1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.myfaces.lifecycle;
21
22 import java.util.ArrayList;
23 import java.util.List;
24 import javax.faces.context.FacesContext;
25 import javax.faces.event.PhaseEvent;
26 import javax.faces.event.PhaseId;
27 import javax.faces.event.PhaseListener;
28
29
30
31
32
33 public class DummyPhaseListenerA implements PhaseListener
34 {
35
36 @Override
37 public void afterPhase(PhaseEvent event)
38 {
39 getMsgList(event.getFacesContext()).add("DummyPhaseListenerA afterPhase");
40 }
41
42 @Override
43 public void beforePhase(PhaseEvent event)
44 {
45 getMsgList(event.getFacesContext()).add("DummyPhaseListenerA beforePhase");
46 }
47
48 @Override
49 public PhaseId getPhaseId()
50 {
51 return PhaseId.RENDER_RESPONSE;
52 }
53
54 public static List<String> getMsgList(FacesContext facesContext)
55 {
56 List<String> list = (List<String>) facesContext.getAttributes().get("msgList");
57 if (list == null)
58 {
59 list = new ArrayList<String>();
60 facesContext.getAttributes().put("msgList", list);
61 }
62 return list;
63 }
64 }