1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.myfaces.view.facelets.pss.acid.managed;
20
21 import javax.faces.bean.ManagedBean;
22 import javax.faces.bean.RequestScoped;
23 import javax.faces.component.UIOutput;
24 import javax.faces.component.UIPanel;
25 import javax.faces.component.UIViewParameter;
26 import javax.faces.component.html.HtmlPanelGroup;
27 import javax.faces.context.FacesContext;
28
29
30
31
32
33 @ManagedBean(name="componentBindingBean")
34 @RequestScoped
35 public class ComponentBindingBean
36 {
37 private UIPanel panel;
38
39 private UIViewParameter viewParam;
40
41 public UIPanel getPanel()
42 {
43 if (panel == null)
44 {
45 panel = new HtmlPanelGroup();
46 if (FacesContext.getCurrentInstance().isPostback())
47 {
48
49
50
51 UIOutput out2 = new UIOutput();
52 out2.setValue("hello2");
53 panel.getChildren().add(out2);
54 }
55 UIOutput out = new UIOutput();
56 out.setValue("hello1");
57 panel.getChildren().add(out);
58 if (!FacesContext.getCurrentInstance().isPostback())
59 {
60
61 panel.getAttributes().put("attr1", "value1");
62 panel.getChildren().get(0).getAttributes().put("attr2", "value2");
63 }
64 else
65 {
66
67 panel.getAttributes().remove("attr1");
68 panel.getChildren().get(0).getAttributes().remove("attr2");
69 }
70 }
71 return panel;
72 }
73
74 public void setPanel(UIPanel panel)
75 {
76 this.panel = panel;
77 }
78
79
80
81
82 public UIViewParameter getViewParam()
83 {
84 return viewParam;
85 }
86
87
88
89
90 public void setViewParam(UIViewParameter viewParam)
91 {
92 this.viewParam = viewParam;
93 }
94 }