gsp页面标签

gsp--Groovy Servers Pages



<g:actionSubmit value=""/>

提交button <g:actionSubmit action="Edit" value="Some label for editing" />



<g:actionSubmitImage value=""/>

图像提交button <g:actionSubmitImage src="/images/submitButton.gif" action="Edit" />



<g:applyLayout></g:applyLayout>

创建layout

<g:applyLayout name="myLayout">some text</g:applyLayout>

<g:applyLayout name="myLayout" template="mytemplate" />

<g:applyLayout name="myLayout" url="http://www.google.com" />

<g:applyLayout name="myLayout" action="myAction" controller="myController">



<g:checkBox name=""/>复选框

<g:collect></g:collect>枚举一个集合并依据定义的expr參数改变结果

<g:cookie name=""/>得到一个cookie的值

<g:country code=""/>依据国家代码输出国家名称



<g:countrySelect/>

显示国家选择下拉框combo box

<g:countrySelect name="myCountry" value="${country}" />



<g:createLink/>从一组属性里创建一个Grails应用链接



<g:createLinkTo/>

创建一个链接到资源<link type="text/css" href="${createLinkTo(dir:'css',file:'main.css')}" />



<g:currencySelect/>

显示币种选择下拉框combo box

<g:currencySelect name="myCurrency" value="${currency}" />



<g:datePicker name=""/>

日期选择器

<g:datePicker name="myDate" value="${new Date()}" />



<g:def/>在gsp文件里定义变量,作为<set>的替代



<g:each></g:each>遍历指定集合中的每一个对象



<g:eachError></g:eachError>循环遍历每一个错误指定的bean或model



<g:else></g:else>else

<g:elseif></g:elseif>else if

<g:encodeAs codec=""></g:encodeAs>指定编码格式的encode



<g:escapeJavascript></g:escapeJavascript>

<g:escapeJavascript>This is some "text" to be escaped</g:escapeJavascript>



<g:external/>

Render the appropriate kind of external link for use in <head>  based on the type of the URI. For JS will render <script> tags,  for CSS will render <link> with the correct rel, and so on for icons.



<g:field type=""/> 创建field



<g:fieldError bean="" field=""></g:fieldError>显示错误信息

<g:fieldError bean="${book}" field="title" />



<g:fieldValue bean="" field=""/>得到字段的值

<g:fieldValue bean="${book}" field="title" />



<g:findall></g:findall> findall method



<g:form></g:form>Form

<g:form action="myaction">...</g:form>

<g:form controller="myctrl" action="myaction">...</g:form>



<g:formatBoolean boolean=""/>

输出给定布尔作为指定的文本标签。假设true和false选项没有给出推断,然后使用默认的标签输出。

<g:formatBoolean boolean="${myBoolean}" />

<g:formatBoolean boolean="${myBoolean}" true="True!" false="False!" />



<g:formatDate/>输出指定的日期格式

<g:formatDate date="${myDate}" format="yyyy-MM-dd  HH:mm" />



<g:formatNumber number=""/>输出指定的数字格式

<g:formatNumber number="${myNumber}" format="###,##0" />



<g:formRemote name="" url=""></g:formRemote>

使用JavaScript提供序列化參数并提交通过ajax异步调用。

<g:grep></g:grep>过滤

採用常规的JDK grep方法遍历每一个元素指定对象的符合规定的“过滤”属性。

过滤器能够是不同的实例。如类,正則表達式模式等。

<g:hasErrors></g:hasErrors>检查是否有错



<g:header name=""/>请求name的值?



<g:hiddenField name=""/>隐藏的field



<g:if></g:if>if



<g:ifPageProperty name=""></g:ifPageProperty>

若页面属性存在,则..

<g:ifPageProperty name="meta.index">body to invoke</ g:ifPageProperty>

<g:ifPageProperty name="meta.index" equals="blah">body to invoke</g:ifPageProperty>



<g:img/>显示照片



<g:include/>存在还有一个controller/action在当前response中

<g:include controller="foo" action="test"></g:include>



<g:javascript></g:javascript>js脚本

<g:javascript>alert('hello')</g:javascript>



<g:join/>连接字符串



<g:layoutBody/>显示Body



<g:layoutHead/>显示Head



<g:layoutTitle/>显示Title

<g:layoutTitle default="The Default title" />



<g:link></g:link>link



<g:localeSelect name="myLocale" value="${locale}" />locate 所在区域



<g:message/>显示错误消息



<g:meta name=""/>从application.properties load application metadata



<g:pageProperty/>显示页面属性

<g:pageProperty default="defaultValue" name="body.onload" />



<g:paginate total=""/>分页

<g:paginate total="${Account.count()}" />



<g:passwordField name=""/>密码文本框



<g:radio name="" value=""/>radio button 单选按钮



<g:radioGroup values="" name=""></g:radioGroup>radio button group 一组单选按钮



<g:remoteField name=""/> remote link



<g:remoteFunction/> remote function



<g:remoteLink></g:remoteLink> remote link



<g:render template=""></g:render>渲染图中集合的一个模板

<g:render template="atemplate" collection="${users}" />

<g:render template="atemplate" model="[user:user,company:company]" />

<g:render template="atemplate" bean="${user}" />



<g:renderErrors/>显示错误



<g:renderException exception=""/>显示异常



<g:renderInput></g:renderInput>显示输入?



<g:resource/>创建一个链接到资源

<link type="text/css" href="${resource(dir:'css',file:'main.css')}" />



<g:select name="" from=""/>dropdown list下拉列表

<g:select name="user.age" from="${18..65}" value="${age}" />

<g:select name="user.company.id" from="${Company.list()}"  value="${user?.company.id}" optionKey="id" />



<g:set></g:set>给变量赋值



<g:setProvider></g:setProvider>set provider



<g:sortableColumn/>可排序的column

<g:sortableColumn property="title" title="Title" />

<g:sortableColumn property="title" title="Title" style="width:  200px" />

<g:sortableColumn property="title" titleKey="book.title" />

<g:sortableColumn property="releaseDate"  defaultOrder="desc" title="Release Date" />

<g:sortableColumn property="releaseDate" defaultOrder="desc" title="Release Date" titleKey="book.releaseDate" />



<g:submitButton name=""/>提交button



<g:submitToRemote></g:submitToRemote>Ajax提交button



<g:textArea name=""></g:textArea>textarea



<g:textField name=""/> textfield



<g:timeZoneSelect name=""/>所在区域的时区

<g:timeZoneSelect name="myTimeZone" value="${tz}" />



<g:unless></g:unless>除非



<g:uploadForm></g:uploadForm>上传表单



<g:validate form="" againstClass=""></g:validate>验证



<g:while></g:while>while



<g:withTag name=""></g:withTag>创建标签

上一篇:Codeforces Round #294 (Div. 2) A and B and Lecture Rooms(LCA 倍增)


下一篇:数据挖掘进阶之序列模式分析算法GSP的实现