Summary
A parent can have many children. How do you write a service such that, if after adding a parent there is an error when adding a child, the entire transaction is rolled back. For example, add parent p1, successfully add child c1, then when adding child c2 an error occurs, both p1 and c1 should be rolled back.
Detailed Problem
In...
Hi everybody,
I'm in a project using Grails,
I user beanFields plugin where I'm changing the bean:inputTemplate into the following
<bean:inputTemplate>
<div class="prop ${hasErrors(bean:$beanName,field:'$fieldId','errors')}">${label}
<span class="value">${field}
</span>
</div>
</bean:inputTemplate>
As you ...
Hi all,
i tried to use in my grails project (1.1.1, on Mac OS X) some image manipulation plugins or java libs: imageTools plugin, imageJ, awt libs etc. Everytime i open/take image from path to start the process, org.codehaus.groovy.grails.cli.support.GrailsStarter jar opens in finder and eats a lot of ram.
Is it correct behaviour?
up...
I have a small Grails application that has the following domain:
class Meal {
String name
String description
String allergyNote
}
For localization purposes the three strings should now be available in multiple languages. For example, while an English user would see name="Steak", a Spanish user should see name="Filete" in the out...
Does anyone know how to test for the first member and last member in a gsp loop?
Here's my jsp code:
<c:forEach items='${aSet}' var='elem' varStatus="loop">
<c:if test='${loop.first}'>
<p>Display something</p>
</c:if>
</c:forEach>
I know you can test for status in a g:each statement but that's just an integer. Is there a...
Hi,
what is the best way to implement some action that should be executed each time a request is made?
My aim is to export some variables layout-wide, so the layout could render some fields like "You are logged in as ${userName}, Server time is ${serverTime}".
I know I can inline code in the gsp, but there should be some better way to...
I'm currently wondering how it is possible to use the Groovy ORM Layer from Grails standalone outside of the Grails Framework. There is a Documentation Entry for doing so, but the ZIP file only links to an empty page. I downloaded Grails 1.2-M3 but I couldn't find anything in the docs either.
Does anybody know what the current state is...
Is possible to overwrite the behaviour of the methods
CreateLink and CreateLinkTo ?
How?
Thanks in advance,
Luis
...
I try to running a grails application in production mode, I see the tutorial in Grails homepage, but I don't have the selectable "configuration Type".
I have a Grails Script parameter field, try to use "production word", but it change nothing ; always in development mode.
An idea to force "production mode" with intelliJ IDEA ?
Thanks
...
The following code will throw a grails.validation.ValidationException if the save fails for some reason. But the result is a generic error. How can I know the actual cause of the error so I can report it back to the user?
def addChild(cName,Parent theParent) {
println "add child: ${cName}"
def theChild = new Child(name:cName,pa...
Hi all,
I'm using the jQuery-UI dialog widget in a Grails-based application to load a remote page (in this case, a simple file upload form). The remote page is defined elsewhere in my project, and doesn't know it is being loaded in a dialog.
Is there any way to close the dialog via a link in the remote page? Would I have to somehow p...
Has any one done it yet? I am having class loader problems de-serializing the grails session object.
Here is the error:
WARN net.spy.memcached.transcoders.SerializingTranscoder: Caught CNFE
decoding 1168 bytes of data
[exec] java.lang.ClassNotFoundException: com.myapp.User
[exec] at org.codehaus.groovy.tools.RootLoad...
The "select" form component in grails can have the form:
<g:select name="user.age" from="${0..59}" value="${age}" noSelection="['':'-All-']"/>
But if I need to add other options aside from the numbers, how would I do that (example options are: 0..59, All, "/5", "/10", etc,...)
Thanks
...
Hi,
There is domain class with natural key defined as below
class InterestGroup {
String intGrp
String name
static constraints = {
intGrp(blank: false, maxSize: 4, unique: true)
name(blank: false, minSize: 10, maxSize: 50)
}
static mapping = {
id generator: "assigned", name: "intGrp", type: 'string'
}
String toString() { ...
I call a service that creates a parent and a child record. If an error happens, the service throws a RuntimeException. The RuntimeExceptionis is caught by the controller and then there there is a redirect back to the gsp. But the error is not being rendered.
In this case, I guess the controller and thus the gsp doesn't really no anythin...
How do I create a catch-all URL-mapping in Grails?
The following Grails UrlMapping ..
class UrlMappings {
static mappings = {
"/$something"{
controller = "something"
action = "something"
}
}
}
.. appears to match ^/[^/]* but how do I create an UrlMapping matching all URLs (^/.*)?
...
Hi guys,
is there any possiblity to select a option field by default in gsp g:select tag?
I only saw the "noSelection" parameter in the documentation.
<g:select name="user.age" from="${18..65}" value="${age}"
noSelection="['':'-Choose your age-']"/>
But I need a default selection from the data I got.
For example 18..65 is my ...
I am unable to read the body of a post to my grails controller. This error is thrown
Caused by: java.lang.IllegalStateException: STREAMED
when I call
request.getReader()
There are some posting on message boards that say to add
parseRequest:true
To the URL mapping. I have done this with no change. Any Help?
...
I have a grails app with a domain Restaurant and a domain Person.
class Restaurant {
String name
static belongsTo = [ owner: Person ]
}
class Person {
String name
static hasMany = [ favoriteRestaurants : Restaurant ]
}
My problem is that GORM creates only two tables, Restaurant and Person, where Restaurant has an owner_id....
Probably a stupid question, but I tried looking this up without much success.
In a Grails app, I have a service with several methods that basically search for certain data using the Domain.createCriteria().list(...){...} construct. For one of those searches ("list all users") I now already have the data (part of a hasMany relationship)...