jsf2入门demo
来源:互联网 发布:犀牛软件调整模型尺寸 编辑:程序博客网 时间:2024/05/18 02:36
环境的搭建参考博客中分类RichFaces下的“创建RichFaces工程”
参考:《JavaServer Faces核心编程(第3版)》
项目目录结构
index.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich"><h:head> <title>Welcome</title></h:head><h:body> <h:form> <h3>please enter your name and password</h3> <table> <tr> <td>Name:</td> <td><h:inputText value="#{user.name}"></h:inputText></td> </tr> <tr> <td>Password:</td> <td><h:inputSecret value="#{user.password}"></h:inputSecret></td> </tr> </table> <p><h:commandButton value="Login" action="welcome"></h:commandButton></p> </h:form></h:body></html>
welcome.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich"><h:head> <title>Welcome</title></h:head><h:body> <h3>Welcome to JavaServer Faces.#{user.name}</h3></h:body></html>
User
import javax.faces.bean.ManagedBean;@ManagedBean(name="user")或者@Named("user")@SessionScopedpublic class User { private String name=""; private String password=""; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; }}
JSF2.0之前需要在WEB-INF/faces-config.xml文件中生命bean,对于一个简单应用程序其实不需要faces-config.xml配置文件
0 0
- jsf2入门demo
- JSF2导航应用demo
- JSF2.X入门
- JSF2.0/Richfaces/MiniOA开发入门视频教程
- java web 开发 之 jsf2 入门系列之1
- JSF2 tutorial
- JSF2.0
- JSF2.0
- JSF2.0
- java web 开发 之 jsf2 入门系列之1 续 1
- MiniOA开发过程记录(7)-JSF2.0/Richfaces/MiniOA开发入门
- Spring入门Demo
- lucene简单入门demo
- spring security3 demo入门
- Web Service 入门Demo
- dll入门demo。
- XStream入门示例DEMO
- springmvc入门demo说明
- Python装饰器单例
- Spark源码解读(6)——Shuffle过程
- Android 可拖拽的GridView效果实现, 长按可拖拽和item实时交换
- Android内容提供者Provider
- 证明增广路算法的正确性及dinic算法的使用
- jsf2入门demo
- noip2011 day2-2 聪明的质监员
- jQuery获取Select选择的Text和 Value
- 只能游客登录以及ubuntu输入密码登录后继续回到登录界面
- php与java通用AES加密解密算法
- 解决 [warn] _default_ VirtualHost overlap on port 80, the first has precedence
- HttpURLConnection+AsyncTask+接口回调实现简易get联网请求封装框架
- input文本框中value值有双引号的问题
- nginx 负载均衡搭建