TA的每日心情 | 开心 2021-3-12 23:18 |
---|
签到天数: 2 天 [LV.1]初来乍到
|
- 最近在密切关注着Java One,EJB3的来临自然是头等大事,但是基于
- 它的应用还不用着急。今天看到了关于JSF的报道,倒是值得拿来说说。
- 来看看JSF最新基于AJAX的API,已经把AJAX简单地封装到底了:
- 1.自动填表栏
- [img]http://img.javaxxz.com/2014/10/10/005227484.gif[/img]
复制代码
代码:
<ui:autoComplete size="40" maxlength="100" id="cityField" completionMethod="#ApplicationBean.completeCity}" value="#{SessionBean.city}" required="true" ondisplay="function(item) { return extractCity(item); }"
onchoose="function(item) { return chooseCity(item); }"/> 2. Google Map

代码:
- <ui:mapViewer id="mapViewerx" center="#{MapBean.mapPoint}" info="#MapBean.mapMarker}"
- markers="#{MapBean.locations}" style="height: 500px; width: 700px"/>
复制代码- [/code]
- 3. 选值填入的输入框
-
- [img]http://img.javaxxz.com/2014/10/10/005233937.gif[/img] 4. 文档编辑器
- [img]http://img.javaxxz.com/2014/10/10/005236312.gif[/img] 5. 类Yahoo的打分按钮
-
- [img]http://img.javaxxz.com/2014/10/10/005238578.gif[/img]
-
- 代码:
- <ui:rating id="rating" maxGrade="5" includeNotInterested="true" includeClear="true"
- hoverTexts="#{RatingBean.ratingText}" notInterestedHoverText="Not Interested"
- clearHoverText="Clear Rating" grade="#{RatingBean.grade}"/>
- 6. 日历
- [img]http://img.javaxxz.com/2014/10/10/005238718.gif[/img]
-
-
- [img]http://img.javaxxz.com/2014/10/10/005240687.gif[/img]
- 7. 表单验证
-
- [img]http://img.javaxxz.com/2014/10/10/005241171.jpg[/img]
-
- 代码:
- <ui:ajaxValidator messageId="input1" eventHook="onkeypress">
- <h:inputText>
- <f:validateLength minimum="3" />
- </h:inputText>
- </ui:ajaxValidator> 8. 上传工具
- [img]http://img.javaxxz.com/2014/10/10/005242875.jpg[/img]
-
- 代码:
- [code]<ui:FileUploadTag id="TestFileuploadForm0" enctype="multipart/form-data"
- retFunction="testRetFunction" retMimeType="text/xml" postProcessingMethod="#{FileUploadProcessing.postProcessingMethod}"
- progressBarDivId="progress" progressBarSubmitId="submit1x" progressBarSize="40">
- <input type="file" size="40" name="fileToUpload0" id="fileToUpload0Id"/><br>
- <input type="file" size="40" name="fileToUpload1" id="fileToUpload1Id"/><br>
- <input type="file" size="40" name="fileToUpload2" id="fileToUpload2Id"/><br>
- <input type="submit" name="submit1x" value="Submit"/>
- <div id="progress"></div><br/>
- </ui:FileUploadTag>
复制代码 - 现在这个AJAX的组件还处在BluePrint中,无法直接下载使用,可以通过Sun的Java Creator安装试用,本人觉得JSF的思想是从.Net那边抄过来的,所以没有个好使的IDE支持写起程序来是挺费劲的。
-
- 有兴趣的朋友可以通过这个网址了解更多:
- [url=http://developers.sun.com/prodtech/javatools/jscreator/reference/techart/2/ajax_samples.html]http://developers.sun.com/prodtech/javatools/jscreator/reference/techart/2/ajax_samples.html[/url]
复制代码 |
|