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 阅读(1139) 评论(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框架的确很多,良莠不齐,只有最合适的,没有最好的,你说是吧。  回复  更多评论
  


只有注册用户登录后才能发表评论。


网站导航: