posted @ 2007-05-11 17:14 風人園 閱讀(226) | 評論 (0) | 編輯 收藏
posted @ 2007-05-10 13:12 風人園 閱讀(325) | 評論 (0) | 編輯 收藏
posted @ 2007-05-09 20:17 風人園 閱讀(280) | 評論 (0) | 編輯 收藏
posted @ 2007-05-09 20:03 風人園 閱讀(996) | 評論 (0) | 編輯 收藏
posted @ 2007-05-09 11:13 風人園 閱讀(1150) | 評論 (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 風人園 閱讀(2155) | 評論 (1) | 編輯 收藏
posted @ 2007-04-26 16:18 風人園 閱讀(6095) | 評論 (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 風人園 閱讀(584) | 評論 (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 風人園 閱讀(557) | 評論 (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" "<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=" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee <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 風人園 閱讀(607) | 評論 (0) | 編輯 收藏
Powered by: BlogJava Copyright © 風人園