Grails
yanchunlili
这个作者很懒,什么都没留下…
展开
-
Writing the <g:if> tag in a tag library
The internal if/else tags that come with Grails translate directlyinto if(..) {} else {} at the syntax level to improve performance ofsuch core tags. But you can quite easily write if/else tag...2008-06-24 11:51:52 · 92 阅读 · 0 评论 -
Configure a bean with map property
1、Using XML <bean id="sqlService" class="SqlService"> <property name="dataSourceMap"> <map> <entry key="a"> <ref bean="2008-05-26 10:33:07 · 86 阅读 · 0 评论 -
Configure a bean with factory using Spring DSL
1、How do I configure a bean like this using Spring DSL? <bean id="mailSession" class="javax.mail.Session" factory-method="getInstance"> <constructor-arg> <pro...2008-05-22 17:38:42 · 83 阅读 · 0 评论 -
Grails学习笔记-1
1、安装JDK和Grails后,设置JAVA_HOME和GRAILS_HOMEsudo gedit /etc/environment加入以下: 1. JAVA_HOME=/usr/lib/j2sdk15-sun //JDK安装路经 2. GRAILS_HOME=/home/boogie/dev/grails //GRails路径 3. P...2007-11-22 11:52:00 · 83 阅读 · 0 评论 -
Property configuration of dataSource
def props = new Properties()InputStream is = new BufferedInputStream(new FileInputStream("${System.getenv("SITEHOME")}/config/cms.properties"))props.load(is)is.close()environments { test { ...原创 2008-07-11 08:42:59 · 138 阅读 · 0 评论 -
Calling static methods on metaclass
1、MyClass with a static methodclass MyClass{ static processList(list) { // does something }} 2、Calling static met...2008-06-15 09:37:26 · 70 阅读 · 0 评论 -
List of all domain classes in BootStrap
import org.codehaus.groovy.grails.commons.ApplicationHolderclass BootStrap { def init = {servletContext -> ApplicationHolder.application.domainClasses.each() { println it...2008-06-14 22:02:46 · 93 阅读 · 0 评论 -
Grails ORM id generator in Oracle
默认自动建立名称为HIBERNATE_SEQUENCE的sequence,可以在domain里用以下方法指定: static mapping = { id generator: 'sequence', params: [sequence: 'seq_name'] }...2008-06-14 20:18:53 · 101 阅读 · 0 评论 -
Get applicationContext in Bootstrap
import org.codehaus.groovy.grails.commons.ApplicationAttributesdef ctx = servletContext.getAttribute(ApplicationAttributes.APPLICATION_CONTEXT) http://www.nabble.com/Bootstrap-and-application...2008-06-14 20:00:04 · 84 阅读 · 0 评论 -
Groovy字符串替换一例
将param替换成paramValue def queryContent = "select * from query where id=${param}"def regex = '\\$\\{param\\}'def matcher = (queryContent =~ /${regex}/)queryContent = matcher.replaceAll('paramValue')...2008-06-12 17:11:29 · 4167 阅读 · 0 评论 -
GORM many-to-many namimg convention
I have class named User and another one named Role and they arerelated to each other in a many-to-many way, a user has many roles andin a role there are many usersBesides the user and role t...2008-06-10 11:50:05 · 190 阅读 · 0 评论 -
Difference between sql.rows().each and sql.eachRow
1、sql.rows returns a List of g.sql.GroovyRowResult which implements Mapdef results = []sql.rows(queryString, args).each {Map row -> println "row.dump():${row.dump()}" ...2008-06-08 10:20:42 · 343 阅读 · 0 评论 -
The main advantage of using the Spring DSL
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.enviro...2008-05-26 10:56:09 · 142 阅读 · 0 评论