posted @ 2007-05-11 17:14 风人园 阅读(214) | 评论 (0) | 编辑 收藏
posted @ 2007-05-10 13:12 风人园 阅读(316) | 评论 (0) | 编辑 收藏
posted @ 2007-05-09 20:17 风人园 阅读(271) | 评论 (0) | 编辑 收藏
posted @ 2007-05-09 20:03 风人园 阅读(987) | 评论 (0) | 编辑 收藏
posted @ 2007-05-09 11:13 风人园 阅读(1143) | 评论 (0) | 编辑 收藏
· 复制 ajax4jsf.jar and oscache-2.2.jar 到程序的 WEB-INF/lib 文件夹下. 修改web.xml,增加a4j的filter配置
在这里我们在父标签(<h:inputText>)中添加了一个AJAX 支持. 该支持绑定了JavaScript事件“onkeyup” .因此, 每一次该事件发布给父标签时,我们的程序将发送一个AJAX请求到Server.这意味着我们的受管理的bean将包含该“text” 域中我们输入的最新数据.
posted @ 2007-04-27 08:54 风人园 阅读(2148) | 评论 (1) | 编辑 收藏
posted @ 2007-04-26 16:18 风人园 阅读(6082) | 评论 (3) | 编辑 收藏
or<from-view-id>*</from-view-id>Using from-action<navigation-case> <from-action>#{quiz.answerAction}</from-action> <from-outcome>again</from-outcome> <to-view-id>/again.jsp</to-view-id></navigation-case><navigation-case> <from-action>#{quiz.startOverAction}</from-action> <from-outcome>again</from-outcome> <to-view-id>/index.jsp</to-view-id></navigation-case>根据不同的action使用不同的导航规则。导航算法
The algorithm has three inputs(算法有三个输入):
The outcome, that is, the value of an action attribute or the string resulting from the invocation of a method reference. action属性的值或者引用方法的返回结果(字符串类型)
The view ID of the current view。当前视图
The action, that is, the literal value of the action attribute in the component that triggered the navigation.用以触发导航的组件属性。
The first of two phases is to find the matching navigation-rule, following these steps(第二阶段的第一步就是寻找符合的导航规则).
The second of two phases is to consider all navigation-case elements in the matching navigation rule (which may consist of several merged navigation-rule elements with matching from-view-id.values).
Follow these steps to find the matching case.
posted @ 2007-04-26 15:23 风人园 阅读(574) | 评论 (0) | 编辑 收藏
一、beans在 faces-config.xml中的定义格式如下:
You can add a locale attribute to the f:view element, for example <f:view locale="de">
You can set the default and supported locales in WEB-INF/faces-config.xml (or another application configuration resource):
<faces-config> <application> <locale-config> <default-locale>en</default-locale> <supported-locale>de</supported-locale> </locale-config> </application> </faces-config>
Request
SessionApplication
五、Configure Bean 设置属性值 <managed-bean> <managed-bean-name>user</managed-bean-name> <managed-bean-class>com.corejsf.UserBean</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> <managed-property> <property-name>name</property-name> <value>me</value> </managed-property> <managed-property> <property-name>password</property-name> <value>secret</value> </managed-property></managed-bean>设置null值<managed-property> <property-name>password</property-name> <null-value/></managed-property>
posted @ 2007-04-26 14:00 风人园 阅读(549) | 评论 (0) | 编辑 收藏
一、JSF开发环境 使用myeclipse的功能,添加相关lib到classpath。 或者从sun的官方网站下载相关lib。http://java.sun.com/javaee/javaserverfaces/download.html二、JSP页面 index.jsp
welcome.jsp
三、Bean UserBean .java package com.test.jsf.bean;
public class UserBean {
private String name;
private String password;
// PROPERTY: name public String getName() { return name; }
public void setName(String newValue) { name = newValue; }
// PROPERTY: password public String getPassword() { return password; }
public void setPassword(String newValue) { password = newValue; } public String check() { name = "wxf"; return "success"; //return SUCCESS; }}四、faces-config<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN" "http://java.sun.com/dtd/web-facesconfig_1_1.dtd"><faces-config > <navigation-rule> <from-view-id>/login/index.jsp</from-view-id> <navigation-case> <from-outcome>login</from-outcome> <to-view-id>/login/welcome.jsp</to-view-id> </navigation-case> </navigation-rule> <managed-bean> <managed-bean-name>user</managed-bean-name> <managed-bean-class> com.test.jsf.bean.UserBean </managed-bean-class> <managed-bean-scope>session</managed-bean-scope> </managed-bean>
</faces-config>五、web.xml<?xml version="1.0" encoding="UTF-8"?><web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <context-param> <param-name>javax.faces.CONFIG_FILES</param-name> <param-value>/WEB-INF/faces-config.xml</param-value> </context-param> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>0</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.faces</url-pattern> </servlet-mapping></web-app>
六、测试 http://localhost:8080/jsf/login/index.faces注意,调用jsp页面时一定要使用faces,结尾,否则jsf的标签将无法识别
posted @ 2007-04-26 12:56 风人园 阅读(597) | 评论 (0) | 编辑 收藏
Powered by: BlogJava Copyright © 风人园