看一下blogjava的发帖风格,以及使用.呵呵
这个博客不错,以后就呆在这里了,发一段代码看看效果.
1/**//*
2 * Page1.java
3 *
4 * Created on 2007年8月29日, 下午2:15
5 * Copyright hadeslee
6 */
7package testvisual;
8
9import com.sun.rave.web.ui.appbase.AbstractPageBean;
10import com.sun.webui.jsf.component.Body;
11import com.sun.webui.jsf.component.Button;
12import com.sun.webui.jsf.component.Form;
13import com.sun.webui.jsf.component.Head;
14import com.sun.webui.jsf.component.Html;
15import com.sun.webui.jsf.component.Link;
16import com.sun.webui.jsf.component.Message;
17import com.sun.webui.jsf.component.Page;
18import com.sun.webui.jsf.component.StaticText;
19import com.sun.webui.jsf.component.TextField;
20import javax.faces.FacesException;
21import javax.faces.event.ValueChangeEvent;
22import javax.faces.validator.LengthValidator;
23
24/** *//**
25 * <p>Page bean that corresponds to a similarly named JSP page. This
26 * class contains component definitions (and initialization code) for
27 * all components that you have defined on this page, as well as
28 * lifecycle methods and event handlers where you may add behavior
29 * to respond to incoming events.</p>
30 */
31public class Page1 extends AbstractPageBean {
32 // <editor-fold defaultstate="collapsed" desc="Managed Component Definition">
33 private int __placeholder;
34
35 /** *//**
36 * <p>Automatically managed component initialization. <strong>WARNING:</strong>
37 * This method is automatically generated, so any user-specified code inserted
38 * here is subject to being replaced.</p>
39 */
40 private void _init() throws Exception {
41 lengthValidator1.setMaximum(10);
42 lengthValidator1.setMinimum(1);
43 lengthValidator2.setMaximum(5);
44 lengthValidator2.setMinimum(1);
45 }
46
47 private Page page1 = new Page();
48
49 public Page getPage1() {
50 return page1;
51 }
52
53 public void setPage1(Page p) {
54 this.page1 = p;
55 }
56
57 private Html html1 = new Html();
58
59 public Html getHtml1() {
60 return html1;
61 }
62
63 public void setHtml1(Html h) {
64 this.html1 = h;
65 }
66
67 private Head head1 = new Head();
68
69 public Head getHead1() {
70 return head1;
71 }
72
73 public void setHead1(Head h) {
74 this.head1 = h;
75 }
76
77 private Link link1 = new Link();
78
79 public Link getLink1() {
80 return link1;
81 }
82
83 public void setLink1(Link l) {
84 this.link1 = l;
85 }
86
87 private Body body1 = new Body();
88
89 public Body getBody1() {
90 return body1;
91 }
92
93 public void setBody1(Body b) {
94 this.body1 = b;
95 }
96
97 private Form form1 = new Form();
98
99 public Form getForm1() {
100 return form1;
101 }
102
103 public void setForm1(Form f) {
104 this.form1 = f;
105 }
106
107 private Button button1 = new Button();
108
109 public Button getButton1() {
110 return button1;
111 }
112
113 public void setButton1(Button b) {
114 this.button1 = b;
115 }
116
117 private LengthValidator lengthValidator1 = new LengthValidator();
118
119 public LengthValidator getLengthValidator1() {
120 return lengthValidator1;
121 }
122
123 public void setLengthValidator1(LengthValidator lv) {
124 this.lengthValidator1 = lv;
125 }
126
127 private Message message1 = new Message();
128
129 public Message getMessage1() {
130 return message1;
131 }
132
133 public void setMessage1(Message m) {
134 this.message1 = m;
135 }
136
137 private TextField textField1 = new TextField();
138
139 public TextField getTextField1() {
140 return textField1;
141 }
142
143 public void setTextField1(TextField tf) {
144 this.textField1 = tf;
145 }
146
147 private LengthValidator lengthValidator2 = new LengthValidator();
148
149 public LengthValidator getLengthValidator2() {
150 return lengthValidator2;
151 }
152
153 public void setLengthValidator2(LengthValidator lv) {
154 this.lengthValidator2 = lv;
155 }
156
157 // </editor-fold>
158
159 /** *//**
160 * <p>Construct a new Page bean instance.</p>
161 */
162 public Page1() {
163 }
164
165 /** *//**
166 * <p>Callback method that is called whenever a page is navigated to,
167 * either directly via a URL, or indirectly via page navigation.
168 * Customize this method to acquire resources that will be needed
169 * for event handlers and lifecycle methods, whether or not this
170 * page is performing post back processing.</p>
171 *
172 * <p>Note that, if the current request is a postback, the property
173 * values of the components do <strong>not</strong> represent any
174 * values submitted with this request. Instead, they represent the
175 * property values that were saved for this view when it was rendered.</p>
176 */
177 public void init() {
178 // Perform initializations inherited from our superclass
179 super.init();
180 // Perform application initialization that must complete
181 // *before* managed components are initialized
182 // TODO - add your own initialiation code here
183
184 // <editor-fold defaultstate="collapsed" desc="Managed Component Initialization">
185 // Initialize automatically managed components
186 // *Note* - this logic should NOT be modified
187 try {
188 _init();
189 } catch (Exception e) {
190 log("Page1 Initialization Failure", e);
191 throw e instanceof FacesException ? (FacesException) e: new FacesException(e);
192 }
193
194 // </editor-fold>
195 // Perform application initialization that must complete
196 // *after* managed components are initialized
197 // TODO - add your own initialization code here
198 }
199
200 /** *//**
201 * <p>Callback method that is called after the component tree has been
202 * restored, but before any event processing takes place. This method
203 * will <strong>only</strong> be called on a postback request that
204 * is processing a form submit. Customize this method to allocate
205 * resources that will be required in your event handlers.</p>
206 */
207 public void preprocess() {
208 }
209
210 /** *//**
211 * <p>Callback method that is called just before rendering takes place.
212 * This method will <strong>only</strong> be called for the page that
213 * will actually be rendered (and not, for example, on a page that
214 * handled a postback and then navigated to a different page). Customize
215 * this method to allocate resources that will be required for rendering
216 * this page.</p>
217 */
218 public void prerender() {
219 }
220
221 /** *//**
222 * <p>Callback method that is called after rendering is completed for
223 * this request, if <code>init()</code> was called (regardless of whether
224 * or not this was the page that was actually rendered). Customize this
225 * method to release resources acquired in the <code>init()</code>,
226 * <code>preprocess()</code>, or <code>prerender()</code> methods (or
227 * acquired during execution of an event handler).</p>
228 */
229 public void destroy() {
230 }
231
232 /** *//**
233 * <p>返回对已限定范围的数据 Bean 的引用。</p>
234 */
235 protected SessionBean1 getSessionBean1() {
236 return (SessionBean1)getBean("SessionBean1");
237 }
238
239 /** *//**
240 * <p>返回对已限定范围的数据 Bean 的引用。</p>
241 */
242 protected RequestBean1 getRequestBean1() {
243 return (RequestBean1)getBean("RequestBean1");
244 }
245
246 /** *//**
247 * <p>返回对已限定范围的数据 Bean 的引用。</p>
248 */
249 protected ApplicationBean1 getApplicationBean1() {
250 return (ApplicationBean1)getBean("ApplicationBean1");
251 }
252
253 public String button1_action() {
254 // 待做事项:处理操作。返回的值是一个导航
255 // 如果名称为 null,则返回到同一页。
256 return "地址";
257 }
258
259 public void textField1_processValueChange(ValueChangeEvent event) {
260 // 待做事项:替换为您的代码
261 System.out.println("看看会调用吗:"+event.getOldValue());
262 }
263}
264
265
尽管千里冰封
依然拥有晴空
你我共同品味JAVA的浓香.
posted on 2007-08-30 09:16
千里冰封 阅读(576)
评论(1) 编辑 收藏