grails

Grails: How to include an html link inside a <g:message> default attribute?

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...

How to handle Many-To-Many In Grails without belongsTo?

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... ...

Grails: Order of view elements in inherited domain object

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 ...

Grails: No tag library for namespace. Cannot use any plugins with custom taglibs.

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:...

Get ahold of session in command object in Grails

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...

Problem getting at the goodies (specifically, serverURL) in my Grails Config.groovy at runtime?

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; ...

How to use more parameters in help-ballon grails-plugin

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?! ...

Asynchronous call in a Grails controller

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 ...

How to programmatically logout in acegi plugin in Grails?

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...

Grails: can remoteField update multiple fields?

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 to do Group By in grails to order by Count(*)

How do I translate: SELECT COUNT(*) AS `count`, `a` FROM `b` GROUP BY `a` ORDER BY `a` into grails or gorm query? ...

Calling TagLib stuff in Grails console?

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... ...

A simple GET with Grails

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...

Parsing in groovy between two tags ?

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 ...

How to get search results in grails if you have the domain (model) name stored in a string

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! ...

Composition in Grails: addTo* in Constructors

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...

How to restrict visibility of domain properties in grails?

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...

why when I delete a parent on a one to many relationship on grails the beforeInsert event is called on the child??

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 {...

Grails problem with nullable contraint in domain class

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 ...

How to configure IntelliJ for running test with JUnit 4?

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(...