Hi!
I have a Groovy application. I am rendering the view list using the following statement:
render (view: 'list', model:[reportingInstanceList: reportingInstanceList, reportingInstanceTotal: i, params: params])
The list.gsp is as follows:
The view is rendered but the default sorting is not working.
<g:sortableColumn class="tabtitle...
Hi,
Why is it that just when I need it, Groovy's "metaClass" property returns null. Example:
import net.sf.json.groovy.JsonSlurper
@Grab(group='net.sf.json-lib', module='json-lib', version='2.3', classifier='jdk15')
def printMeta(obj) {
obj.metaClass.properties.each {println "Property: ${it.name}"}
}
def raw = /{"test":"this is...
why does this throw an exception?
messageSource.getMessage('UserService.msg.forgot.unknown', ["[email protected]"], null)
unless I do this...
def Object[] args = ["[email protected]"]
messageSource.getMessage('UserService.msg.forgot.unknown', args, null)
...
I am trying to download an attachment from GMAIL using the java mail API, this the the code snippet
System.setProperty("mail.mime.base64.ignoreerrors", "true")
if ( mp.getBodyPart(i).disposition == "ATTACHMENT" ) {
def OutputStream out
try {
out = new BufferedOutputStream(newFileOutputStream("/_1test.pdf"));
...
Hi,
I'm trying to pass the value "1" into a Grails tag. However, it turns out to be an integer value of 49 - the ascii value for "1". How do I convert this to the proper value in Groovy?
...
I wanted to know if it was possible to use Spring MVC with a dynamic language like Groovy or Scala. Or can Groovy only be run on Grails?
Also if it is possible, is this something which people try often, or do they just stick to the framework traditionally used?
...
I'm writing a grails plugin and I need to hook into the domain save() method to do some logic after the save. I need to do this across multiple domain classes. I'm trying to avoid hibernate events in the cases where a plugin user is not using hibernate with GORM.
I've tried many thing but below is what I think should have had the best ...
What a the best books for learning Groovy and Grails for an experienced Java developer?
...
Is Groovy a superset of Java yet? If not, what are the incompatibilities between Groovy and Java?
By superset, I mean source backward compatibility, in the sense that: you can take a Java file and compile it as Groovy source file, and it would work just as before. It has been the goal of Groovy to make very similar to Java, to minimiz...
I don't want to break any rules here but happy christmas everyone of you!
In a silent hour an idea crossed my mind:
Is it possible to replace any java coding which I use daily with groovy or scala? E.g. writing small webapps which include servlets/portlets etc.
...
Hello,
Usecase: Player may have award or may not have. If player never had any award then Award will be null, ( 1. Is there any other way to do this.. without null.. I don't feel its good idea)
I am generating scaffold for following domain structure.
class Player {
String name
Award recentAward
static constraints = {
...
I've a problem using Enumeration in Grails:
I try to use an enumeraion in a grails domain object
code:
package it.xxx.tools.kanban
import java.util.Date;
class Task {
String name
String description
Priority priority
static belongsTo = [user:User, project:Project]
static constraints = {...
I know similar questions have been asked many times befor, but I think this one slitly different :)
I'm writing a maven report plugin which will send emails to a list of users. I now have the problem, that the code seems to be working fine when I run it with java5, but failes with java6.
Actualy the plugin is writen in Groovy and uses t...
i was going through railstutorial and saw the following one liner
('a'..'z').to_a.shuffle[0..7].join
it creates random 7 character domain name like following:
hwpcbmze.heroku.com
seyjhflo.heroku.com
jhyicevg.heroku.com
I tried converting the one liner to groovy but i could only come up with:
def range = ('a'..'z')
def tempList ...
I need one specific 'div'-tag (identified by 'id') from a html site. To parse the page
I'm using cyberneko.
def doc = new XmlParser( new org.cyberneko.html.parsers.SAXParser() ).parse(htmlFile)
divTag = doc.depthFirst().DIV.find{ it['@id'] == tagId }
So far no problem, but at the end I don't need XML, but the original conte...
I am sick of encapsuling each call of asType with try/catch block like :
def b = ""
def c
try {
c = b as Integer
}
catch (NumberFormatException) {
c = null
}
println c
instead I would like to write in my code the following:
def b = ""
def c = b as Integer
and if b is not well-formatted, then I want to have null be assigne...
I want to let users supply a groovy class with a property that is a file-selector closure which I pass on to AntBuilder's 'copy' task:
class Foo {
def ANT = { fileset(dir:'/tmp/tmp1') }
}
in my code, I pick up the ANT property as 'fAnt' and pass to Ant:
ant.copy(todir:'/tmp/tmp2', fAnt)
This works - but, if the user passe...
The groovy own library for XML-RPC does not support basic authorization. I try to use httBuilder ( http://groovy.codehaus.org/modules/http-builder/home.html ) build on top of HttpComponents http://hc.apache.org/) to access TRAC via XML-RPC.
def postBody = """
<?xml version="1.0"?>
<methodCall>
<methodName>wiki.getPage</methodName>
<par...
I'm trying to use javamail in a groovy script to send out an email via gmail. I've looked many places online and have been unable to get it working thus far. The error I'm getting when running my script is:
DEBUG SMTP: useEhlo true, useAuth false
DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 25, isSSL false
Caught: javax....
I would like to implement the following:
import org.springframework.web.servlet.support.RequestContextUtils as RCU
class HomeController {
def home = {
def locale = RCU.getLocale(request)
render view: viewExists("home_$locale") ? "home_$locale": "home"
}
}
What is the code of boolean viewExists(String viewPath)...