Hi,
I am starting with Grails and want to have one page with multilanguage content.
I started using the tag which works fine.
But here is what I want to do:
I want to include the default text of the default language right in the text, to avoid switching back and forth in between files.
<g:message code="homepage.feature.headline1" d...
I need to create a many-to-many relationship in Grails.
I have a "Question" domain and a "Tag" domain.
A Question can have 0 or more tags. A Tag can have 0 or more Questions.
If I put a "hasMany" on each sides, it gives me an error saying I need a "belongTo" somewhere.
However, adding a belongsTo means that the owner must exist... ...
Hello,
One can specify the order of view elements in GSP file by specifying it in the validation block of the corresponding domain class. If the lass is inherited, the parameter of parent class is always displayed first. For eg
class A {
string a
String b
static constraints = {
b()
a()
}
}
class B extends A{
String c
String d
...
I can't seem to use any of the grails ui plugins such as richui or grails-ui. I used grails install-plugin to install them, and grails list-plugins shows that they are correctly installed. However, whenever I use their provided taglibs in my views, I get this exception:
Tag [tabview] does not exist. No tag library found for namespace:...
How can I get the session from within a command object?
I have tried:
import org.springframework.security.context.SecurityContextHolder as SCH
class MyCommand {
def session = RCH.currentRequestAttributes().getSession()
}
This throws
java.lang.IllegalStateException: No thread-bound request found: Are you referring to request att...
Similar to question 198365, I'm trying to access serverURL in Config.groovy, during bootstrap.
Using code from that question/answer, I'm getting a value of null. Is there something else I'm missing?
import org.codehaus.groovy.grails.commons.ConfigurationHolder;
def serverURL = ConfigurationHolder.config.grails.serverURL;
...
I try to use more of the parameters but could not get it working with
<g:helpBalloon title="foo" content="bla" useEvent="['mouseover']" />
should result in
<script type="text/javascript"> new HelpBalloon({ title: 'foo', content: 'bla', useEvent: ['mouseover'] }); </script>
but useEvent="['mouseover']" seems not to be recognized?!
...
Is there a way to implement this?
redirect(url: "${myDomain1RootUrl}/j_spring_security_logout") // make this asynchronous call
redirect(url: "${myDomain2RootUrl}/j_spring_security_logout") // make this asynchronous call
redirect(uri: "/j_spring_security_logout")
Basically, this code is going to logout the session for several internal ...
Is there a similar logic for logout using this login code:
// login account
def autht = new AuthToken(username, password)
def authtoken = daoAuthenticationProvider.authenticate(autht)
SecurityContextHolder.context.authentication = authtoken
I checked LogoutController and this is the only logic for logout:
redirect(uri: '/j_spring_sec...
Hi,
Assume i have a book entity with an isbn field.
When entered a isbn number, i want 2 fields to be updated: title and author.
My controller looks like this:
def ajaxGetBook = {
def book = Book.findByIsbn(params.isbn)
if(book==null) book = new Book()
render book as JSON
}
So my call works, and i get a f...
How do I translate:
SELECT COUNT(*) AS `count`, `a` FROM `b` GROUP BY `a` ORDER BY `a`
into grails or gorm query?
...
Is there a way to call a taglib closure from inside the grails console? I want to be able to get at the message tag within the grails console and I can not figure this out...
...
I have built a simple Grails app, with a domain-class and its controller (with the default scaffold functionality).
I want to use this for an Android app.
I had to get my objects in the JSON format, and thanks to stackoverflow it's been easy ;)
Now I have to put data. I should make a POST call to http://localhost:8080/MyApp/person/sav...
I would like to parse this Gstring with groovy :
Format type : Key, Value.
def txt = """ <Lane_Attributes>
ID,1
FovCount,600
FovCounted,598
...
</Lane_Attributes> """
And get a map like :
Map = [ID:1, FovCount:600, FovCounted:598]
How can ...
I have a method which has domain name as a String parameter.
def modelName="Equity"
I want to use it like
def results=modelName.findAll()
Please guide me!
...
I have the following simplified model in Grails:
A DataBlock consists of a number of sorted ConfigPreset objects.
In ConfigPreset I have
static belongsTo = [dataBlock: DataBlock]
and the DataBlock class contains:
List presets
static hasMany = [presets: ConfigPreset]
DataBlock() {
addToPresets(new ConfigPreset())
}
The over...
Is there any recommended way to restrict the visibility of a domain in grails?
Normally you you do something like to get some interface for external use:
def productList = Product.list()
withFormat {
html {[productList:productList]}
json { render productList as JSON }
xml { render productList as XML }
rss { render(feedType:"rss...
hello, I have a one to many relationship and when I try to delete a parent that haves more than one child the berforeInsert event gets called on the frst child. I have some code in this event that I mean to call before inserting a child, not when i'm deleting the parent! any ideas on what might be wrong?
the entities:
class MenuItem {...
Hi, I'm having the following problem with grails' 1.2.1 domain classes:
When I set a constraint attr(nullable:true) and attr is int or bool, this condition isn't reflected in the db (postgresql 8.4). However, if attr is a String, the DB is consistent with the situation.
Any hints ?
Thanks
...
Should be simple but I couldn't figure it out.
When running my unit test inside IntelliJ, I could not find a way to tell IntelliJ-9.0 that it should use JUnit4 instead of JUnit3.
When a test fails, IntelliJ console displays:
MyTests.testConstraints(MyTests.groovy:20) at
...
com.intellij.junit3.JUnit3IdeaTestRunner.doRun(...