The internal if/else tags
that come with Grails translate directly
into if(..) {} else {} at the syntax level to improve performance of
such core tags
. But you can quite easily write if/else tags
using the
pageScope
object and Grails' standard tags
for example:
d ...
1、MyClass with a static method
class MyClass
{
static processList(list)
{
// does something
}
}
2、Calling static method processList
doProcessList(String className, list)
{
MetaClass mc = ...
import org.codehaus.groovy.grails.commons.ApplicationHolder
class BootStrap {
def init = {servletContext ->
ApplicationHolder.application.domainClasses.each() {
...
默认自动建立名称为HIBERNATE_SEQUENCE的sequence,可以在domain里用以下方法指定:
static mapping = {
id generator: 'sequence', params: [sequence: 'seq_name']
}
import org.codehaus.groovy.grails.commons.ApplicationAttributes
def ctx =
servletContext.getAttribute(ApplicationAttributes.APPLICATION_CONTEXT)
http://www.nabble.com/Bootstrap-and-applicationContext-td16302106.html#a16302106
将param替换成paramValue
def queryContent = "select * from query where id=${param}"
def regex = '\\$\\{param\\}'
def matcher = (queryContent =~ /${regex}/)
queryContent = matcher.replaceAll('paramValue')
参考: http://docs.codehaus.org/display/GROOVY/Tutorial+5+-+Capturing+r ...
I have class named User and another one named Role and they are
related to each other in a many-to-many way, a user has many roles and
in a role there are many users
Besides the user and role tables I get another table named role_user
which has only two fields: roles_id and use ...
1、sql.rows
returns a List of g.sql.GroovyRowResult
which implements Map
def results = []
sql.rows(queryString, args).each {Map row ->
println "row.dump():${row.dump()}"
results << row
}
2、sql.
eachRow
iterates providing a g. ...
The main advantage of using the Spring DSL is that you can now mix logic in within your bean definitions, for example based on the environment
:
import grails.util.*
beans {
switch(GrailsUtil.environment) {
case "production":
myBean(my.company.MyBeanImpl) {
bookService = ...
1、Using XML
<bean id="sqlService" class="SqlService">
<property name="dataSourceMap">
<map>
<entry key="a">
<ref bean="dataSourceA"/>
</entry>
<entry key=&quo ...
- 浏览: 120766 次
- 性别:

- 来自: 宁波

- 详细资料
搜索本博客
我的相册
张瑞希6
共 8 张
共 8 张
最近加入圈子
链接
最新评论
-
在基于Spring架构的通用查 ...
你好,你能给我这个通用查询的详细代码吗?我的邮件chsboy@hotmail.c ...
-- by javachs -
在基于Spring架构的通用查 ...
你好,你能给我这个通用查询的详细代码吗?我的邮件iorit2003@yahoo. ...
-- by iorit2003 -
ORACLE中表、索引的表空间 ...
写的是很好,就是让人要很很的琢磨
-- by futily -
利用JavaScript DOM函数动 ...
!已经解决,谢谢
-- by woogy -
利用Dojo和JSON建立无限级 ...
非常的感谢!
-- by fcllingzi






评论排行榜