网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > Java
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
网络编程:ASP教程,ASP.NET教程,PHP教程,JSP教程,C#教程,数据库,XML教程,Ajax,Java,Perl,Shell,VB教程,Delphi,C/C++教程,软件工程,J2EE/J2ME,移动开发
本月文章推荐
.在 WAS 中使用 Java 安全套接字扩.
.接口与实现.
.揭开Java 安全标准的神秘面纱.
.Eclipse开发struts完全指南一(全.
.Eclipse中报错的解决方案.
.实现目录删除,取得目录大小及深.
.中国移动增值服务的前景分析(全.
.数据操作相关函数笔记.
.SCJP1.4高效率复习提纲.
.中断Java线程.
.关于JAVA import 的一个小问题.
.JDBC解决方案.
.JAVA虚拟机实例学习笔记一.
.在servlet中直接写端口发送邮件的.
.Java Web Start 技术.
.Mini Java编译器(三).
.java连接MySql数据库!.
.关于spring中的aop的解释.
.Java如何调用可执行文件和批处理.
.使用JDOM操作XML系列文章一 从数.

使用Java Server Faces技术自定义组件

发表日期:2008-1-5



  CUSTOM COMPONENTS WITH JavaSERVER FACES TECHNOLOGY
The March 24, 2004 Tech Tip Improving Designs With the MVC Design Pattern introdUCed the architectural pattern known as Model, View, Controller (MVC or Model2). MVC is a pervasive pattern throughout the world of computer science, and is fundamental to understanding JavaServer Faces (JSF) technology. The pattern separates the data and business logic of an application from its visual representation. The data and business logic is stored in an object called the Model. The visual representation is stored in a separate object called the View. The two objects are linked together with a third object called the Controller. The controller reacts to input from the view and updates the model data accordingly. The advantage of using this design is that any changes to the business logic or data can be isolated to the model without affecting the view. You can create multiple views without affecting the model.

A second tip in the March 24, 2004, titled Introducing JavaServer Faces Technology showed how to create a JSF application that includes GUI components that are modeled by the JSF framework. In this tip, you'll learn how to create custom components using JSF technology. More specifically, you'll learn how to create a custom JSF technology component that represents a simple stock display. Through an accompanying JavaServer Pages (jsp) page, a user can enter a stock symbol into a input text field and then press the Submit button. In response, the custom component displays a table below the text field. The table contains the stock's symbol, the current price of the stock, and the daily change in the stock price.

This tip assumes that you are familiar with the basics of JSF technology, and you know how to create JSP technology custom tag libraries. For information on the basics of JSF technology, see An Introduction to JavaServer Faces. For information on creating your own JSP custom tag libraries, see Using Custom Tags in the J2EE 1.4 Tutorial.

To create the custom component, you need to:

Create a JavaBean Model class that can be used to retrieve the stock data


Create a custom JSF View output component class that extends javax.faces.component.UIComponent.


Create a custom JSF View class that extends javax.faces.render.Renderer.


Integrate the custom component into the JSF framework using a custom tag.


Create a JSP page, including an input text field, and a backing bean for the input text field to assist the custom component.


Here is a visual representaion of how these objects fit in the MVC architecture.
上一篇:使用设计模式改善程序结构(一) 人气:776
下一篇:使用java.util.Calendar返回间隔天数 人气:978
浏览全部Java的内容 Dreamweaver插件下载 网页广告代码 祝你圣诞节快乐 2009年新年快乐