Rational Application Developer 8(RAD8)出来之后,试了一下《 Java EE 6 导学》中的JSF例子,下面的截图和代码。
WebSphere Applications Server 测试环境运行效果图
Rational Application Developer 8(RAD8)图形化设计关键界面
页面代码和managed bean 代码
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<title>Facelets Hello Greeting</title>
</h:head>
<h:body>
<h:form>
<h2>Hello, my name is ChinaJava.net. What’s yours?</h2>
<h:inputText id="username"
value="#{hello.name}"
required="true"
requiredMessage="A name is required."
maxlength="25">
</h:inputText>
<p></p>
<h:commandButton id="submit" value="Submit" action="response1">
</h:commandButton>
<h:commandButton id="reset" value="Reset" type="reset">
</h:commandButton>
</h:form>
</h:body>
</html>
-----------------------------------------------------
response1.xhtml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<title>Facelets Hello Response</title>
</h:head>
<h:body>
<h:form>
<h2>Hello, #{hello.name}!</h2>
<p></p>
<h:commandButton id="back" value="Back" action="index1" />
</h:form>
</h:body>
</html>
-----------------------------------------------
package hello1;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
@ManagedBean
@RequestScoped
public class Hello {
private String name;
public Hello() {
}
public String getName() {
return name;
}
public void setName(String user_name) {
this.name = user_name;
}
}
本文展示了使用Rational Application Developer 8 (RAD8) 和 Java EE 6 进行 JSF 应用开发的过程。通过两个 XHTML 页面和一个 Managed Bean 的实现,演示了用户输入收集与反馈的基本交互。
1404

被折叠的 条评论
为什么被折叠?



