6.1 Controllers

A controller handles requests and creates or prepares the response and is request-scoped.  In other words a new instance is created for each [request|controllers]. A controller can generate the response or delegate to a view. To create a controller simply create a class whose name ends with @Controller@ and place it within the @grails-app/controllers@ directory.
一个控制器(Controllers)是请求范围的,用于处理请求,创建或者准备响应。换句话说,每次[request|controllers]会创建一个新的控制器(Controllers)实体。一个控制器(Controllers)能产生响应或者委托给一个视图。创建一个控制器(Controllers),简单创建一个类名以 @Controller@ 结尾的类,并放于@grails-app/controllers@目录中。
The default [URL Mapping|guide:mapping] setup ensures that the first part of your controller name is mapped to a URI and each action defined within your controller maps to URI within the controller name URI.
默认的[URL Mapping|guide:mapping]设置能确保你的控制器(Controllers)名字的第一部分被映射到一个URI上,并且控制器(Controllers)中的每个Actions(操作)定义被映射到控制器(Controllers)命名URI中的URI。


你可能感兴趣的:(grails)