I'd like my Grails web-app to send an e-mail for each exception that reaches the end-user.
Basically I'm looking for a elegant way to achieve something equivalent to:
try {
// ... all logic/db-access/etc required to render the page is executed here ...
}
catch (Exception e) {
sendmail("[email protected]", "An exce...
Let's say I have two tables employee and salary with a 1:N relationship (one salary can be associated with many employees).
In plain SQL the tables would be joined with:
SELECT e.id, e.name, s.salary FROM employee e, salary s WHERE s.id = e.salary_id AND e.id = 12345;
Assuming the following GORM-powered domain class how do I map the ...
Can anyone give a specific example of when the following setting in Config.groovy is used?
// set per-environment serverURL stem for creating absolute links
environments {
production {
grails.serverURL = "http://www.changeme.com"
}
...
}
What I am looking for is a use-case where not changing the above setting will ...
Hi guys,
i have a grails project with an Image Domain Class and Controller.
I just installed the grails ImageTools 1.0.4 Plugin and i would like to generate thumbnails for images wich will be uploaded.
My Image-Domain-Class:
class Image {
byte[] data
//String name
byte[] thumbnail
static constraints = {
//name()
data()
}
}
...
I would like to add a field to an existing domain class. I do not want to lose my view files however as I know will happen if i run generate-all. Is there another way I can update the mapping etc?
...
The Config.groovy setting "grails.views.default.codec" specifies the default codec used to encode data with ${...}.
This config setting can take any of the values "none", "html" and "base64".
I understand the reason to why one would set them to "none" (no filtering required) or "html" (to avoid XSS-attacks), but why would anyone like ...
I am developing grails application which uses file searching.For that I wrote the following code. This code works and it is gives the results with case sensitive.But I want to search files without case sensitive.
def criteria = FileDomain.createCriteria()
def results = criteria {
and {
like('user', User.findById(session?.user...
I am developing a application in grails which uses lot of ajax.In one part I used the following code :
<iframe id="hidden-upload-frame" style="border:none;height:25px;width:100%;" onload="${remoteFunction(action: 'list', controller: 'file', update: [success: 'fileDomain', failure: 'fileDomain'])}">
</iframe>
<div id="fileDomain">
</di...
What are some general guidelines on when to set fetchMode to "eager" in a domain class? Pros and cons of fetchMode "eager" vs. the default "lazy"?
Please include some specific examples/use-cases showing when to use "eager" (fetchMode=eager), and when not to (fetchMode=lazy).
...
In an ordinary one-to-many mapping the "one"-side is the owner of the association. Why would anyone use the belongsTo-mapping for such a mapping? Am I missing some side-effect of specifying belongsTo?
In other words: what are the effects of specifying a belongsTo-mapping in GORM vs. not specifying it?
...
We have an existing "legacy" app written in C++/powerbuilder running on Unix with it's own Sybase databases. For complex organizational(existing apps have to go through lot of red-tape to be modified) and code reasons(no re-factoring has been done in yrs so the code is spaghetti), so it's difficult to get modifications done to this appl...
Hi,
I've seen various posts on SO criticising the Eclipse Grails plugin, and am wondering if anyone has found a way to work productively with Grails within Eclipse?
I had a look at the Grails plugin page, and the information there doesn't look very promising, particularly the conflicting advice regarding the 'Disable Groovy Compiler Ge...
Folks
In Windows, JAVA_HOME must point to the JDK installation folder (so that JAVA_HOME/bin contains all executables and JAVA_HOME/libs contains all default jar libraries).
If I download Sun's JDK bundle and installs it in Linux, it is the same procedure.
However, I need to use Kubuntu's default OpenJDK package. The problem is that a...
Hi
I am developing a grails application which uses lot of ajax.If the request is ajax call then it should give response(this part is working), however if I type in the URL in the browser it should take me to the home/index page instead of the requested page.Below is the sample gsp code for ajax call.
<g:remoteFunction action="list" con...
The GString concept in Groovy is pretty powerful (see http://groovy.codehaus.org/Strings+and+GString).
GStrings let you do things like:
world = "World"
println "Hello ${world}"
# Output: Hello World
println "1+2 = ${1+2}"
# Output: 1+2 = 3
println "${System.exit(-1)}"
# Program terminated
I'm trying to figure out if using Groovy GStr...
Hi there!
How can I access or better pass on a bunch of domain classes from a controller in Grails to a quite simple java program residing in src/java within the grails tree? I always get a ClassNotFoundException for the domain classes, regardless in which package I put them in. There's no auto-completion pointing to the domain classes ...
Hi,
Assume I have a Grails domain object like this:
class Todo {
String name
String priority
String status
static constraints = {
name(blank: false)
priority()
}
}
What are the default constraints on a field if:
It's listed in the constraints block without any actual contraints, e.g. priori...
The following grails script:
// Import.groovy
includeTargets << grailsScript("Bootstrap")
target(main: "Import some data...") {
depends(bootstrap)
def Channel = grailsApp.classLoader.loadClass("content.Channel")
def c
// works: saving a valid Channel succeeds
c = Channel.newInstance(title:"A Channel", slug:"a-c...
Yes/no-question: Is there a Groovy GDK function to capitalize the first character of a string?
I'm looking for a Groovy equivalent of Perl's ucfirst(..) or Apache Commons StringUtils.capitalize(str) (the latter capitalizes the first letter of all words in the input string).
I'm currently coding this by hand using ..
str = str[0].toUpp...
Most Java code is also syntactically valid Groovy code. However, there are a few exceptions which leads me to my question:
Which constructs/features in Java are syntactically invalid in Groovy? Please provide concrete examples of Java code (Java 1.6) that is NOT valid Groovy code (Groovy 1.6).
Update:
So far we've got five examples o...