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

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

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

    littleQ

    終于明白曾經他們失落的目光,當年的你們是否一樣;間有懈怠或有頹放,難知多久方能補上;今起,不再彷徨!

      BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
      33 Posts :: 0 Stories :: 60 Comments :: 0 Trackbacks

    歡迎使用Induction!Induction是使用java編程語言進行web應用開發的健壯高性能的框架。Induction屬于基于請求的web框架,作為一個servlet部署在servlet容器中。Induction宣揚MVC的方法進行web應用開發。Induction的幾個關鍵設計目標是:
    1.當modles,views和controllers發生變化時,消除對web應用程序必須重載的需求(我們相信一次簡單的頁面刷新就足夠了)
    2.modles,views,controllers之間的綁定是聲明式的,這種方式可以在任何IDE中都能被解析
    3.使得數據跟蹤在用戶界面模板中可用(尤其是HTML模板)
    4.文件上傳處理應該簡單到很平凡的地步
    5.在HTML表格中,數組(arrays)和字典類型(dictionary types )的使用應該盡可能簡單
    6.明智的使用XML(在每個應用程序中,Induction只需要一個XML文件)
    7.是一種能夠適應多種pattern應用的可擴充的架構
    8.高性能
    9.從JDK1.4到1.6都兼容(包括1.4和1.6)

    About this tutorial
    這份指南的目的是讓你更快的使用Induction。Induction需要一個servlet容器。在這份指南中,我們使用Apache的Tomcat,不過你可以選擇使用任何服從標準的servlet容器。

    Installing
    我們假設你已經在c:/dev/Tomcat6安裝了Tomcat6。Induction本身不需要任何的安裝步驟,它的jar包可以很容易地引入到你的web應用程序中。

    Writing our first application - hello world
    在這份指南中,我們會寫一個簡單的"hello world"應用,在這個應用里我們會列舉出Induction的許多重要概念。

    Writing a controller
    首先我們寫一個controller作為我們指南的開始,因為controllers是web應用程序中一個典型的entry。好,現在讓我們開始寫一個controller,讓它在瀏覽器中打印一串字符。

    package demoapp.helloworld1_app;
     
    import com.acciente.induction.controller.Controller;
    import com.acciente.induction.controller.Response;
    import java.io.IOException;

    /**
     * A very simple controller that does the customary "Hello World"
      
    */

    public class HelloWorldController implements Controller
    {
       
    public void handler( Response oReponse ) throws IOException
       
    {
          oReponse.setContentType( 
    "text/plain" );
          oReponse.out().println( 
    "Hello World, using a simple println()" );
       }

    }
     

    在我們運行這個controller之前,先仔細的看一下。首先我們注意到HelloWorldController類實現了Induction的Controller,Controller接口只是一個簡單的標記接口,沒有定義任何方法給它的實現類。當Induction接收到一個request請求后,激活一個Controller實現,比如HelloWorldController類,Induction首先核實這個類是否是實現Controller接口。因此目前Controller接口的存在的唯一理由是安全(主要考慮到Controller接口的可配置性)。因為Controller只是一個標記性接口,所以handler方法并不是接口定義的。

    接下來,我們可以看到handler方法有一個Response參數,Response類是繼承javax.servlet.http.HttpServletResponse接口,并簡單的對servlet容器的response對象進行了封裝。Induction通過注入的方式,將參數Response值傳給handler方法。一些能夠作為handler參數的值,也是通過自動注入的方式,只要它們是遵循以下類型:
    Type Description
    Request facade to the servlet request, extends javax.servlet.http.HttpServletRequest
    Response facade to the servlet response, extends javax.servlet.http.HttpServletResponse
    Form provides access to the HTML form (if any) submitted with this request
    ControllerResolver.Resolution provides access to the controller resolution object (very useful for writing generic parameterized controllers)
    model_class_name instance of a user provided model class, the instance is managed to conform to a user specified lifecycle

    上面的類名是不完整的,Request, Response和Form類的更多信息,在package com.acciente.induction.controller中查看。

     

    原文地址:http://www.inductionframework.org/getting-started-tutorial.html

    先翻譯一部分放上來,后面的會盡快貼出。

    翻譯的不通暢的地方,請見諒~

    posted on 2008-07-30 22:16 littleQ 閱讀(1154) 評論(3)  編輯  收藏 所屬分類: inductionjava

    Feedback

    # re: Getting Started with Induction-翻譯(1) 2008-07-31 03:13 深圳旅游資訊網
    參考一下  回復  更多評論
      

    # re: Getting Started with Induction-翻譯(1) 2008-07-31 09:21 隔葉黃鶯
    好是好,不過在 Spring MVC、WebWork、Struts1/2 之間,對于鄭重的項目很難有好的理由選擇這個框架,除非你完全決斷。  回復  更多評論
      

    # re: Getting Started with Induction-翻譯(1) 2008-07-31 09:49 melland
    @隔葉黃鶯
    web框架的確很多,良莠不齊,只有最合適的,沒有最好的,你說是吧。  回復  更多評論
      


    只有注冊用戶登錄后才能發表評論。


    網站導航: