Controller中默认的Action是index,可以通过defaultAction指定默认的Action
// Here the 'list' action is the default as there is only one action defned class SampleController { def list() {} }
这个Controller中只有一个list Action,访问时需要定向到list才能访问到有效路径
// In this example 'index' is the default by convention class SampleController { def list() {} def index() {} }
这个Controller中有index和list两个action,系统会默认index为默认
// Here 'list' is explicitly set as the default class SampleController { static defaultAction = 'list' def list() {} def index() {} }
这个Controller中有两个action并指定list为默认,则系统会定向到list,并且在浏览器路径中不显示具体路径