JSF是一个新的基于MVC模型的web应用框架技术。在概念和特征方面,尤其是组件方面,超过了著名的Struts框架。而Myfaces是Apache软件基金的一个项目,它实现了JSF框架。同样sun公司也有一个参考实现 JSF RI。但是myfaces比JSF RI提供了更多的组件和特征。
Myfaces组件是一套用于JSF的组件,里面的tomahawk包(t标签)包含了丰富的组件,只需要几个简单的标签就可以实现一些很有用的功能。
例如:树,文件的上传下载,日历 等
<t:inputFileUpload> 这个上传组件
Myfaces+Richfaces的自定义组件问题。
inputFileUpload标签
1.JSCookMenu
JSF Implementations
? Sun (RI)
? IBM
? Apache MyFaces
? Simplica (based on Apache MyFaces)
? additionally, there are several 3rd party UI components that
should run with any implementation.
MyFaces provides:
? Implementation of JSF-API
? javax.faces.** Classes
? Implementation of JSF Spec
? org.apache.myfaces.** Classes
JAR files of Apache MyFaces
? myfaces-impl.jar
? myfaces-jsf-api.jar
? tomahawk.jar
? sandbox.jar
? myfaces-all.jar (all in one jar file –
except sandbox)
应用
MyFaces in Action
? several custom components
? custom validator components
? custom extensions
<t:jscookMenu layout="hbr" theme="ThemeIE" id="menu" rendered="true" >
<t:navigationMenuItem itemLabel="Employee">
<t:navigationMenuItem itemLabel="Search By Id" action="/FruitList.xhtml"/>
<t:navigationMenuItem itemLabel="Search By Name" action="/FruitList.xhtml"/>
<t:navigationMenuItem itemLabel="Add" action="/FruitList.xhtml"/>
</t:navigationMenuItem>
</t:jscookMenu>
一用户日历组件
1.以表格样式显示
<x:inputCalendar value="#{travel.arrival}" />
2以弹出样式显示
<x:inputCalendar renderAsPopup="true" value="#{travel.depature}" />
不能点击?
二用户上传组件
<h:form enctype="multipart/form-data">
<x:inputFileUpload value="#{backing.file}" required="true"/>
</h:form>
三tree2组件?
四选项板Tabbed Pane
<x:panelTabbedPane bgcolor="#FFFFCC">
<x:panelTab id="tab1" label="Main Menu">
<h:outputText/>
<h:inputText value="#{TBean.TAttribute}"/>
</x:panelTab>
<x:panelTab id="tab2" label="second Menu">
</x:panelTab>
<h:commandButton value="Submit it!" action="#{personalMemberBean.userRegister}" />
</x:panelTabbedPane>
五...
六用户验证组件
1 nest them inside Input Components
<h:inputText value=?...>
<x:validateEmail/>
</h:inputText>
messages.properites
org.apache.myfaces.Email.INVALID 邮箱格式不正确
2 ISBN (<x:validateISBN/>)
3 CreditCard (<x:validateCreditCard/>)
4 Regular Expression
<x:validateRegExpr pattern=?/d{5}“/>
5 Equal
<h:inputText id=?password1“ ...>
<h:inputText id=?password2“ ...>
<x:validateEqual for=?password1“/>
</h:inputText>
参考 csdn5/MyFaces_Tutorial(JSF%26MyFaces教程).pdf