jsf in action 笔记:在组件中使用EL语言(Using the EL with components)--2008.04.11
2008-04-11 16:31
543 查看
2008.04.11 摘自 JSF in action 2.4.3 Using the EL with components Page/117
JSF的EL表达式可以将组件与Backing Bean或者Model Object联系起来,可以将组件中的展现与对象中的属性的值动态关联,也可以将某个按钮与Backing Bean对象中的某个方法关联起来,包可以将整个组件与对象中的某个属性关联.就像这样
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<h:inputTextArea value="#{registrationForm.comments}"/>
将HtmlInputTextArea中的value值与registrationForm对象中的comments属性动态关联起来.如果属性的类型是一个集合(List,Array,Map等),可以这样<h:graphicImage value="#{user.icons[5]}">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<h:inputText value="#{registrationForm.comments}" binding="#{registrationForm.nameInput}"/>
如果采用binding的属性,那么类的属性的类型与组件的类型要是一样的(是HtmlInputText或是HtmlInputText的子类),当需要在类中控制组件的属性的时候才使用绑定(binding).
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<h:inputTextarea value="#{registrationForm.comments}"
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
binding="#{registrationForm.commentsInput}"
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
valueChangeListener="#{registrationForm.commentsChanged}"
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
validator="#{registrationForm.checkSpelling}"
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
styleClass="#{initParam[commentStyle]}"
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
rows="10"
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
cols="80"
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
title="#{appBundle.commentsTitle}"/>
JSF的EL表达式可以将组件与Backing Bean或者Model Object联系起来,可以将组件中的展现与对象中的属性的值动态关联,也可以将某个按钮与Backing Bean对象中的某个方法关联起来,包可以将整个组件与对象中的某个属性关联.就像这样
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<h:inputTextArea value="#{registrationForm.comments}"/>
将HtmlInputTextArea中的value值与registrationForm对象中的comments属性动态关联起来.如果属性的类型是一个集合(List,Array,Map等),可以这样<h:graphicImage value="#{user.icons[5]}">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<h:inputText value="#{registrationForm.comments}" binding="#{registrationForm.nameInput}"/>
如果采用binding的属性,那么类的属性的类型与组件的类型要是一样的(是HtmlInputText或是HtmlInputText的子类),当需要在类中控制组件的属性的时候才使用绑定(binding).
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<h:inputTextarea value="#{registrationForm.comments}"
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
binding="#{registrationForm.commentsInput}"
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
valueChangeListener="#{registrationForm.commentsChanged}"
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
validator="#{registrationForm.checkSpelling}"
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
styleClass="#{initParam[commentStyle]}"
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
rows="10"
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
cols="80"
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
title="#{appBundle.commentsTitle}"/>
相关文章推荐
- WMI005-WMI学习笔记(五)——Using WMI with the .NET Framework(.NET框架使用WMI)
- jsf in action 笔记:在页面的海洋中导航(3.4 Navigating the sea of pages)--2008.04.16
- jsf in action 笔记:标准组件(一)--组件列表--2008.04.16
- Using the Version-Aware Component 使用版本识别组件
- jsf in action 笔记:web.xml配置(Configuration)--2008.04.11
- jsf in action 笔记:理解组件和客户端的标识(Understanding component and client identifiers)--2008.04.09
- SSIS教程:创建简单的ETL包 -- 6. 对项目部署模型使用参数(Using Parameters with the Project Deployment Model)
- 关于spring.net的面向切面编程 (Aspect Oriented Programming with Spring.NET)-使用工厂创建代理(Using the ProxyFactoryObject to create AOP proxies)
- Dynamic CRM 2013学习笔记(三十)Linq使用报错 A proxy type with the name account has been defined by another assembly
- jsf in action 笔记:通过值绑定初始化Bean(Setting values with value-binding expressions)--2008.04.15
- 使用Java语言进行2D游戏编程基础 Fundamental 2D Game Programming with Java 全书笔记(未完结)
- 对收藏夹中AspectJ和Spring结合使用例子(What the teacher said (using AspectJ with Spring part II). )的补充
- jsf in action 笔记:请求处理的生命周期(The Request Processing Lifecycle)--2008.04.08
- [Redux] Using withRouter() to Inject the Params into Connected Components
- JSF笔记 – JSF中的三大核心组件 UI标签的详细介绍和使用举例
- jsf in action 笔记:应用配置组成(Application Configuration)--2008.04.11
- jsf in action 笔记:页面语言(Expression Language)--2008.04.09
- Using Claims in your Web App is Easier with the new OWIN Security Components
- SPRING IN ACTION 第4版笔记-第十章Hitting the database with spring and jdbc-004-使用NamedParameterJdbcTemplate
- 学语言最好的方法是尽量多地联系使用它。(The way to learn a language is to practice using it as often as possible.)