Groovy&Grails-速查手册-Grails标签(Tags)

逻辑标签

标签名
描述
<g:if>
Logical switch based upon a test expression
<g:else>
The else portion of an if statement
<g:elseif>
The elseif portion of an if statement

迭代标签
标签名
描述
<g:while>
Executes a loop while a test condition is true
<g:each>
Iterates over a collection
<g:collect>
Iterates over a collection and transforms the results as defined in the expr parameter
<g:findAll>
Iterates over a collection where the elements match the GPath defined in the expr parameter
<g:grep>
Iterates over a collection where the elements match the filter defined in the expr parameter

分配标签

可以使用分配标签创建并赋值给一个变量

标签名
描述
<def> (deprecated)
Defines a variable to be used within the GSP page; use <set> instead
<set>
Sets the value of a variable used within the GSP page

链接标签
标签名
描述
<g:link>
Creates an HTML link using supplied parameters
<g:createLink>
Creates a link that you can use within other tags
<g:createLinkTo>
Creates a link to a directory or file


Ajax标签

标签名
描述
<g:remoteField>
Creates a text field that invokes a link when changed
<g:remoteFunction>
Creates a remote function that is called on a DOM event
<g:remoteLink>
Creates a link that calls a remote function
<g:formRemote>
Creates a form tag that executes an Ajax call to serialize the form elements
<g:javascript>
Includes JavaScript libraries and scripts
<g:submitToRemote>
Creates a button that executes an Ajax call to serialize the form elements

表单标签
标签名
描述
<g:actionSubmit>
Creates a submit button
<g:actionSubmitImage>
Creates a submit button using an image
<g:checkBox>
Creates a check box
<g:currencySelect>
Creates a select field containing currencies
<g:datePicker>
Creates a configurable date picker for the day, month, year, hour, minute, and second
<g:form>
Creates a form
<g:hiddenField>
Creates a hidden field
<g:localeSelect>
Creates a select field containing locales
<g:radio>
Creates a radio button
<g:radioGroup>
Creates a radio button group
<g:select>
Creates a select/combo box field
<g:textField>
Creates a text field
<g:textArea>
Creates a text area field
<g:timeZoneSelect>
Creates a select field containing time zones

UI标签

标签名
描述
<g:richTextEditor>
Creates a rich text editor, which defaults to fckeditor

渲染和布局标签

标签名
描述
<g:applyLayout>
Applies a layout to a body or template
<g:encodeAs>
Applies dynamic encoding to a block of HTML to bulk-encode the content
<g:formatDate>
Applies a SimpleDateFormat to a date
<g:formatNumber>
Applies a DecimalFormat to number
<g:layoutHead>
Displays a decorated page’s header, which is used in layouts
<g:layoutBody>
Displays a decorated page’s body, which is used in layouts
<g:layoutTitle>
Displays a decorated page’s title, which is used in layouts
<g:meta>
Displays application metadata properties
<g:render>
Displays a model using a template
<g:renderErrors>
Displays errors
<g:pageProperty>
Displays a property from a decorated page
<g:paginate>
Displays Next/Previous buttons and breadcrumbs for large results
<g:sortableColumn>
Displays a sortable table column

验证标签
标签名
描述
<g:eachError>
Iterates through errors
<g:hasErrors>
Checks if errors exist within the bean, model, or request
<g:message>
Displays a message
<g:fieldValue>
Displays the value of a field for a bean that has data binding

你可能感兴趣的:(Groovy&Grails-速查手册-Grails标签(Tags))