grails

grails portlet preferences

Hi, How to get portlet preferences in grails for liferay .?? I used : import javax.portlet.* def renderEdit = { PortletPreferences pref = RenderRequest.getPreferences() println pref ['mykey':'myvalue'] } but getting issue : No signature of method: static javax.portlet.RenderRequest.getPreferences() is applicable...

javascript in grails paginate

hi, can we call javascript function from g:paginate tag . I need to call a javascript function when clicked on next page/number . I'm using like this but no luck : g:paginate next="Forward" prev="Back" max="100" maxsteps="15" controller="Links" action="list" total="${Links.count()}" onclick="return show_waiting();"/> function show_w...

Jodatime groovy/grails daterange search with TimeZone conversion

I am currently storing Joda DateTime (Datetime+TimeZone) values into a database. What I want to do grab 24 hours of records based on the timezone of the user, rather than UTC time. I.E. I want to grab the records between 00:00GMT-24:00GMT for people whose timezone is GMT, and 00:00PST-24:00PST for people whose timezone is PST. Now I do...

HTML parsing - fetch and update data from the .html file

I have a form in a .html files where input/select box looks like this <input type="text" id="txtName" name="txtName" value="##myName##" /> <select id="cbGender" name="cbGender"> <option>Select</option> <option selected="selected">Male</option> <option>Female</option> </select> I would need to remove '##' value textbox and also up...

Problem calling grails service from gsp

Hi, how can I invoke a service directly from a view ? I'm trying with ${my.domain.service.method} but it complains it can't find the property. And no, I don't want to use a controller because the view is a template. Thanks ...

Grails Navigation with Dynamic Values

I'm using the grails navigation plugin and one of the things i want to do is have the menu item have a dynamic number in it for example static navigation = [ group:'tabs', order:7, title:'Mail', action:'index', subItems: [ [action:'pending', order:1, title:"Pending"], [action:'active', order:1...

grails console issue : No Hibernate Session bound to thread,

i'm trying to learn Grails console and had a problem. It looks like this: When I start grails console in my project WITHOUT starting the project, I can persist data to my postgreSQL database. However, when I started the project (after a bunch of error messages from netbeans output), I cannot do what I did anymore from Grails console. ...

Weird UrlMappings behavior for Grails 1.2.1

I've created a Grails (1.2.1) application in SpringSource Tools Suite 2.3.2 and here is my UrlMappings.groovy: class UrlMappings { static mappings = { "/$controller/$action?/$id?"{ constraints { // apply constraints here } } "/broadcasters/setInterval" { //cause a 404 controller = "broadcas...

Is it possible to override List accessors in Grails domain classes?

If I have a List in a Grails domain class, is there a way to override the addX() and removeX() accessors to it? In the following example, I'd expect MyObject.addThing(String) to be called twice. In fact, the output is: Adding thing: thing 2 class MyObject { static hasMany = [things: String] List things = [] void addT...

Maintaining both sides of self-referential many-to-many relationship in Grails domain object

I'm having some problems getting a many-to-many relationship working in grails. Is there anything obviously wrong with the following: class Person { static hasMany = [friends: Person] static mappedBy = [friends: 'friends'] String name List friends = [] String toString() { return this.name } } class Bo...

Grails: <g:select...

How can I achieve the following: I have a boolean stored in my Domain, by default Grails creates a checkbox as a control. I want a select control with values : Active/Inactive. On selecting Active the value True should be passed and On selecting InActive the value False should be passed. How can I achieve this using <g:select name=...

What are the steps to upgrade maven/grails from 1.2.0 to 1.2.1?

I have recently started a new project using the maven grails archetype - at the time, (a few weeks ago), Grails 1.2.0 was the most recent release. Now that there's a newer release, what are the steps to upgrade? I would assume that since Grails dependencies are defined in the POM, that the POM will need to be updated? Are there any instr...

Why don't Domain class static methods work from inside a grails "service"?

I want a grails service to be able to access Domain static methods, for queries, etc. For example, in a controller, I can call IncomingCall.count() to get the number of records in table "IncomingCall" but if I try to do this from inside a service, I get the error: org.springframework.beans.factory.BeanCreationException: Error creat...

Grails: Mapping to response codes, impossible to change http status code

"404" (controller: 'error', action: 'pageNotFound') Any changes to response.status inside the pageNotFound action is reverted back to 404 before the response is sent to the client. Is it possible to work around this some way? I would like to be able to change it to 410 when I detect that the resource has been deleted or 301 when it's m...

Grails application Complaint with the REST

I have made an grailsapplication. Now i have to make it complaint with the REST protocol. how do i do this ? can i get any material where i have examples of how to carry out this process ??groovygrails ...

Best practice for assigning A/B test variation based on IP address

I am starting to write some code for A/B testing in a Grails web application. I want to ensure that requests from the same IP address always see the same variation. Rather than store a map of IP->variant, is it OK to simply turn the IP address into an integer by removing the dots, then use that as the seed for a random number generator...

Grails database checkboxes best practices to load and process

Hi, I have a collection of checkboxes loaded from a table that are loaded in a gsp (via a controller). Are there any best practices in grails to display them and process them once the form is submitted ? I wouldn't like to use the "manual" approach (i.e, composing the checkboxxes'id with the table row's id). Thanks ...

Hibernate: Found: float, expected: double precision

I have a problem with the mapping of Oracle Float double precision datatype to Java Double datatype. The hibernate schema validator seems to fail when the Java Double datatype is used. org.hibernate.HibernateException: Wrong column type in DB.TABLE for column amount. Found: float, expected: double precision The only way to avoid this ...

Map problem when passing it as model to view in grails

Hi, In a controller, I have populated a map that has a string as key and a list as value; in the gsp, I try to show them like this: <g:each in="${sector}" var="entry" > <br/>${entry.key}<br/> <g:each in="${entry.value}" var="item" > ${item.name}<br/> </g:each> </g:each> The problem is that item is considered as string, so I ...

Grails web flow: Possible to include the state name in the url?

I'm playing around with Google Analytics goals / funnels. I would like to use this to track a checkout process, but the web flow urls are formated in a way that makes this very hard. Would it be possible to change: http://localhost:8080/checkout/checkout?execution=e1s2 .. into something more like this: http://localhost:8080/checkout/ch...