<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    風人園

    弱水三千,只取一瓢,便能解渴;佛法無邊,奉行一法,便能得益。
    隨筆 - 99, 文章 - 181, 評論 - 56, 引用 - 0
    數據加載中……

    ruby 入門

    1、安裝及配置
    2、HelloWorld

    posted @ 2007-05-11 17:14 風人園 閱讀(226) | 評論 (0)編輯 收藏

    Struts2 flow 配置


    1、默認配置
    2、別名
    3、返回結果

    posted @ 2007-05-10 13:12 風人園 閱讀(325) | 評論 (0)編輯 收藏

    PHP框架

    FleaPHP   http://www.fleaphp.org/

    posted @ 2007-05-09 20:17 風人園 閱讀(280) | 評論 (0)編輯 收藏

    RadRails使用參考

    利用Radrails開發Ruby on Rails程序入門指南
    http://blog.csdn.net/futurelight/archive/2006/09/27/1297526.aspx

    詳解用radrails調試rails應用程序
    http://www.javaeye.com/topic/40548

    使用 RadRails 和 Eclipse 可以輕松進行 Ruby on Rails 開發
    http://www.ibm.com/developerworks/cn/opensource/os-ecl-radrails/

    以上為幾個使用參考

    posted @ 2007-05-09 20:03 風人園 閱讀(996) | 評論 (0)編輯 收藏

    Struts2--form設計


    1、form的 theme屬性

    你可以在<s:form>加上theme="simple"屬性,然后自已布局form的輸出。如:
    <s:form action="Login" method="POST" theme="simple">
    <table>
    <tr>
    <td>
    User name: <s:textfield name="name" label="User name"/>
    </td>
    <td>
    Password: <s:password name="password" label="Password"/>
    </td>
    </tr>
    </table>
    </s:form>

    posted @ 2007-05-09 11:13 風人園 閱讀(1150) | 評論 (0)編輯 收藏

    JSF--ajax4jsf入門示例(repeater)

    一、下載
    http://labs.jboss.com/jbossajax4jsf/downloads,現在的版本為1.1

    ·            復制 ajax4jsf.jar and oscache-2.2.jar 到程序的 WEB-INF/lib 文件夾下.
    修改web.xml,增加a4j的filter配置

    <filter>
              
    <display-name>Ajax4jsf Filter</display-name>
              
    <filter-name>ajax4jsf</filter-name>
              
    <filter-class>org.ajax4jsf.Filter</filter-class>
              
    </filter>
              
    <filter-mapping>
              
    <filter-name>ajax4jsf</filter-name>
              
    <servlet-name>Faces Servlet</servlet-name>
              
    <dispatcher>REQUEST</dispatcher>
              
    <dispatcher>FORWARD</dispatcher>
              
    <dispatcher>INCLUDE</dispatcher>
              
    </filter-mapping>
    </filter>

    二、JSP

    <%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <html>
        
    <head>
            
    <title>repeater</title>
        
    </head>
        
    <body>
            
    <f:view>
                
    <h:form>
                    
    <h:panelGrid columns="2">

                            
    <h:outputText value="Type the Text:" />
                            
    <h:inputText value="#{bean.text}">
                                    
    <a4j:support event="onkeyup" reRender="repeater" />
                            
    </h:inputText>

                            
    <h:outputText value="Text in the AJAX Response:" />
                            
    <h:outputText id="repeater" value="#{bean.text}" />

                    
    </h:panelGrid>
            
    </h:form>

            
    </f:view>
        
    </body>
    </html>
    <a4j:support event="onkeyup" reRender="repeater"/>

    在這里我們在父標簽(<h:inputText>)中添加了一個AJAX 支持. 該支持綁定了JavaScript事件“onkeyup” .因此, 每一次該事件發布給父標簽時,我們的程序將發送一個AJAX請求到Server.這意味著我們的受管理的bean將包含該“text” 域中我們輸入的最新數據.

    <a4j:support> 標簽的“reRender” 屬性(attribute)定義我們的頁面的哪一部分被更新. 在這里,該頁面唯一被更新的部位是 <h:outputText> 標簽,因為他的ID值和“reRender” 的屬性值向匹配. 在一個頁面中更新多個元素(elements)也是很簡單的:僅僅把他們的IDs放在 “reRender” 屬性中就可以了.

    三、Bean & faces-config.xml
    package com.ivo.a4j.bean;

    public class Bean {

        
    private String text;

        
    public Bean() {
            
    //text = "11";
            
    //System.out.println("Create");
        }


        
    public String getText() {
            
    return text;
        }


        
    public void setText(String text) {
            
    this.text = text;
        }


    }

    faces-config.xml
    <?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>

        
    <managed-bean>
            
    <managed-bean-name>bean</managed-bean-name>
            
    <managed-bean-class>com.ivo.a4j.bean.Bean</managed-bean-class>
            
    <managed-bean-scope>request</managed-bean-scope>
        
    </managed-bean>

    </faces-config>

    posted @ 2007-04-27 08:54 風人園 閱讀(2155) | 評論 (1)編輯 收藏

    JSF--整合spring

    使用JSF-Spring整合
    一、下載
    進官方網站http://jsf-spring.sourceforge.net,下載lib

    二、參考quickstart配置相應文件
    http://jsf-spring.sourceforge.net/quickstart.shtml
    最終配置結果如下
    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/classes/faces/faces-config.xml, 
                /WEB-INF/classes/faces/faces-config-beans.xml
            
    </param-value>
        
    </context-param>
        
    <context-param>
            
    <param-name>contextConfigLocation</param-name>
            
    <param-value>
                classpath*:spring/applicationContext-*.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>
        
    <listener>
            
    <listener-class>
                org.springframework.web.context.request.RequestContextListener
            
    </listener-class>
        
    </listener>
        
    <listener>
            
    <listener-class>
                org.springframework.web.context.ContextLoaderListener
            
    </listener-class>
        
    </listener>
        
    <listener>
            
    <listener-class>de.mindmatters.faces.spring.context.ContextLoaderListener</listener-class>
        
    </listener>
            
    </web-app>

    請注意以上listener的順序,如果位置不同可能出現找不到在spring中定義的bean。請按以上順序配置即可。

    根據quitstart配置完之后可能還有如下異常:
    org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: javax.faces.el.EvaluationException: de.mindmatters.faces.spring.factory.BeansEvaluationException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'uiBean': Scope 'request' is not active; nested exception is java.lang.IllegalStateException: No thread-bound request: use RequestContextFilter
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:532)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:408)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
    com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:147)
    de.mindmatters.faces.lifecycle.RenderResponsePhase.executePhase(RenderResponsePhase.java:45)
    de.mindmatters.faces.lifecycle.AbstractPhase.execute(AbstractPhase.java:37)
    de.mindmatters.faces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:166)
    de.mindmatters.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:226)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
    然后再把這個listener加上
    <listener>
      <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
     </listener>

    就ok了。

    可選
    如果還有問題,在faces-config.xml中添加
    <application>
         <variable-resolver>
          org.springframework.web.jsf.DelegatingVariableResolver
         </variable-resolver>
      <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
     </application>

    posted @ 2007-04-26 16:18 風人園 閱讀(6095) | 評論 (3)編輯 收藏

    JSF--Navigate

    JSF中最重要的導航設置
    一、靜態導航
    <h:commandButton label="Login" action="login"/>
    通過action返回的字符串,然后比較   from-outcome標簽值,如果相同,就返回到   to-view-id  制定的頁面
    注: view ID strings must start with a /.
    二、動態導航
    <h:commandButton label="Login" action="#{loginController.verifyUser}"/>
    根據action中調用的bean方法返回值來確定顯示頁面
    loginController的驗證方法
    String verifyUser() {

       if (...)

          return "success";

       else

          return "failure";

    }


    三、高級導航
    Redirection
    如果你在to-view-id 后 加redirect元素,則JSP容器即中斷當前request請求,并發送一個HTTP redirect 請求到client. 
    <navigation-case>
       <from-outcome>success</from-outcome>
       <to-view-id>/success.jsp</to-view-id>
       <redirect/>
    </navigation-case>

    Wildcards(通配符)
    <navigation-rule>
       <from-view-id>/secure/*</from-view-id>
       <navigation-case>
          . . .
       </navigation-case>
    </navigation-rule>
    只要是在/secure/這個目錄下的頁面都使用這個導航規則。

    所有
    <from-view-id>/*</from-view-id>

    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(第二階段的第一步就是尋找符合的導航規則).

    • If the outcome is null, return immediately and redisplay the current page.(如果outcome是空,則立刻返回重新顯示當前頁面)
    • Merge all navigation rules with the same from-view-id value.(合并相同from-view-id的導航規則)
    • Try to find a navigation rule whose from-view-id value matches the view ID exactly. If such a rule exists, take it.
    • Consider all navigation rules whose from-view-id values end with a wildcard suffix, such as secure. For each such rule, check whether the prefix (after removing the *) is identical to the corresponding prefix of the view ID. If there are matching rules, take the one with the longest matching prefix.
    • If there is a rule without a from-view-id, take it.(如果有沒有from-view-id的規則,使用)
    • If there is no match at all, redisplay the current page.(如果都沒有符合,重新顯示當前頁面)

    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.

    • If a case has both matching from-outcome and from-action, take it.
    • Otherwise, if a case has matching from-outcome and no from-action, take it.
    • Otherwise, if a case has matching from-action and no from-outcome, take it.
    • Otherwise, if there is a case with neither from-outcome or from-action, take it.
    • If there is no match at all, redisplay the current page.
      Naturally, we recommend that you do not create tricky navigation rules in your own programs. As long as you stay away from wildcards and from-action elements, you won't need to know about the gory details of the navigation algorithm.


     

    posted @ 2007-04-26 15:23 風人園 閱讀(584) | 評論 (0)編輯 收藏

    JSF--Managed Beans

    一、beans在 faces-config.xml中的定義
    格式如下:

    <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-bean>
    意思:在session中創建了一個user名字的UserBean對象。
    在bean定義之后,就可以通過JSF組件來訪問Bean的屬性。
     如    <h:inputSecret value="#{user.password}"/>,訪問userbean的password屬性。

    二、Message Bundle
    自定義資源文件com/corejsf/messages.properties,通過f:loadBundle訪問
    <f:loadBundle basename="com.corejsf.messages" var="msgs"/>
    basename : properties文件的路徑
    var: 文件定義的message key

    com/corejsf/messages_de.properties.
    國際化,在默認資源文件的基礎上,增加后綴,標識語言類別。

    語言默認顯示設置
  • 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>
    
    三、Backing Beans
    四、Bean Scope
  • Request

    Session
    Application

    五、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-- 入門 First Example

    一、JSF開發環境
       使用myeclipse的功能,添加相關lib到classpath。 或者從sun的官方網站下載相關lib。
    http://java.sun.com/javaee/javaserverfaces/download.html
    二、JSP頁面
          index.jsp

    <html>
        
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
        
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>

        
    <f:view>
            
    <head>
                
    <title>A Simple JavaServer Faces Application</title>
            
    </head>
            
    <body>
                
    <h:form>
                    
    <h3>Please enter your name and password.</h3>
                    
    <table>
                        
    <tr>
                            
    <td>Name:</td>
                            
    <td><h:inputText value="#{user.name}" /></td>
                        
    </tr>
                        
    <tr>
                            
    <td>Password:</td>
                            
    <td><h:inputSecret value="#{user.password}" /></td>
                        
    </tr>
                    
    </table>
                    
    <p><h:commandButton value="Login" action="login" /></p>
                
    </h:form>
            
    </body>
        
    </f:view>
    </html>


          welcome.jsp

    <html>
        
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
        
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>

        
    <f:view>
            
    <head>
                
    <title>A Simple JavaServer Faces Application</title>
            
    </head>
            
    <body>
                
    <h3> Welcome to JavaServer Faces,
                    
    <h:outputText value="#{user.name}" /> !
                
    </h3>
            
    </body>
        
    </f:view>
    </html>


    三、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)編輯 收藏

    僅列出標題
    共10頁: First 上一頁 2 3 4 5 6 7 8 9 10 下一頁 
    主站蜘蛛池模板: 日韩激情无码免费毛片| 国产a v无码专区亚洲av| 国产精品亚洲五月天高清| 亚洲中文久久精品无码ww16| 免费无码毛片一区二区APP| 亚洲AV成人影视在线观看 | 91免费国产在线观看| 亚洲国产精品无码久久| 亚洲人精品午夜射精日韩| 中文字幕成人免费视频| 国产成人综合亚洲绿色| 亚洲精品私拍国产福利在线| 成人性生交大片免费看无遮挡| 男女污污污超污视频免费在线看| 久久亚洲精品无码AV红樱桃| 国产免费变态视频网址网站| 9420免费高清在线视频| 一个人看的免费高清视频日本| 久久久久久亚洲Av无码精品专口 | 亚洲一区二区三区高清视频| 亚洲AV日韩精品一区二区三区| 中文字幕天天躁日日躁狠狠躁免费| 视频一区二区三区免费观看| 亚洲酒色1314狠狠做| 亚洲午夜AV无码专区在线播放| 亚洲精品免费网站| 国产免费爽爽视频在线观看 | 色噜噜亚洲男人的天堂| 亚洲日韩精品一区二区三区 | 亚洲综合网美国十次| 不卡精品国产_亚洲人成在线| 免费a级毛片无码a∨蜜芽试看| a毛片在线看片免费| 国产精品亚洲精品日韩动图| 亚洲国产精品综合久久网各| 亚洲无线观看国产精品| 亚洲国产精品一区二区三区久久| 野花高清在线观看免费完整版中文| 精品一卡2卡三卡4卡免费视频| 精品久久久久久亚洲综合网| 亚洲www在线观看|