2007年5月10日 星期四

Connect DB by ODBC on Rails

  1. Install
    rails 1.2 gem install -v=1.4 odbc-rails
    rails 1.1 gem install -v=1.3 odbc-rails

  2. Enabling Loading of the Adapter
    -> root\lib\ruby\gems\1.8\gems\activerecord-1.14.4\lib\active_record
         RAILS_CONNECTION_ADAPTERS = %w( mysql postgresql ... openbase odbc)

  3. Set up your Ap
    your ap -> config/environment.rb
                         require File.join(File.dirname(__FILE__), 'boot')
                         require 'odbc_adapter'
    -> config/database.yml
                         development:
                         adapter: odbc
                         dsn: 使用者資料來源名稱
                         username:
                         password:
                         host: localhost
                         encoding: utf8

2007年5月2日 星期三

[ICEfaces]支援myafecsTomahawk元件

1.myfaces lib
myfaces-core 1.1.5 & tomahawk v1.1.5

2.icefaces lib
ICEfaces-1.6.0-DR4

3.RI implementation會跟myfaces起衝突,把jsf-api.jar和jsf-impl.jar拿出

4.web.xml設定

(1)加入servlet
   servlet
           servlet-name Main Dispatch Servlet servlet-name
          servlet-class com.icesoft.faces.webapp.http.servlet.MainServlet servlet-class
          load-on-startup 1 load-on-startup
   servlet

   servlet-mapping
           servlet-name Main Dispatch Servlet servlet-name
           url-pattern *.iface url-pattern
   servlet-mapping

(2)將FacesServletExtensionsFilter所mapping的去除,
否則會造成myfaces和icefaces之間無法cast的錯誤

(3)加入context-param
context-param
   param-name
          com.icesoft.faces.standardRequestScope
   param-name
   param-value
          true
   param-value
context-param

(4)加入listener
listener
    listener-class
           com.icesoft.faces.webapp.http.servlet.SessionDispatcher$Listener
    listener-class
listener

5.faces-config.xml設定
若有使用facelets,將view-handler改成com.icesoft.faces.facelets.D2DFaceletViewHandler
取代com.sun.facelets.FaceletViewHandler

參考資料:
Status of ICEfaces Support for MyFaces Tomahawk Components