grails

Groovy question: "except" syntax?

I am a total Groovy newbie. I saw the following code on http://docs.huihoo.com/grails/1.0.3/ref/Controllers/beforeInterceptor.html def beforeInterceptor = [action:this.&auth,except:'login'] How would I expand this to also include a second exception, say, if the action was 'login2'? ...

Getting Groovy's Grape Going!!!

I've tried to use the new Groovy Grape capability in Groovy 1.6-beta-2 but I get an error message; unable to resolve class com.jidesoft.swing.JideSplitButton from the Groovy Console (/opt/groovy/groovy-1.6-beta-2/bin/groovyConsole) when running the stock example; import com.jidesoft.swing.JideSplitButton @Grab(group='com.jidesoft', m...

Adding a method to a domain class

I have a domain class containing a couple of fields. I can access them from my .gsps. I want to add a method to the domain class, which I can call from the .gsps (this method is a kind of virtual field; it's data is not coming directly from the database). How do I add the method and how can I then call it from the .gsps? ...

Running a web app in Grails vs Django

I'm currently in the planning stage for a web application and I find myself trying to decide on using Grails or Django. From an operation perspective: Which ecosystem is easier to maintain (migrations, backup, disaster recovery etc.)? If using grails it'll probably be a typical tomcat + mysql on linux. If django it'll be apache + my...

How do I get at the goodies in my Grails Config.groovy at runtime?

in Config.groovy I see this: // set per-environment serverURL stem for creating absolute links environments { production { grails.serverURL = "http://www.changeme.com" } } what is the correct way to access that at runtime? ...

Best practices for grails index page

What is the right way to populate the model for the index page in a grails app? There is no IndexController by default, is there some other mechanism for getting lists of this and that into the model? ...

Grails File Upload Problems

I'm trying to emulate the file upload code from the grails website, and I'm running into some problems. I'm using the same code as found here. Here is my code: <g:form action="upload" method="post" enctype="multipart/form-data"> <input type="file" name="myFile" /> <input type="submit" value="Upload" /> </g:form> and def uploa...

Two Domain Objects in One View

Can two domain objects show on the same page, when the list method is called, for example? http://APP_NAME/foo/list def list = { if(!params.max) params.max = 10 [ fooList: Foo.list( params ) ] [ barList: Bar.list( params ) ] // Only the last one is returned. } On the view page, both tables would be displayed on the ...

Javascript Postback in Grails

Does anyone know how to initiate a POST request in a Grails applications using javascript. Specifically, I would like to be able to POST when a the selected item in a drop-down box is changed. I've tried using jQuery and the $.post() method. It successfully calls my controller action, but I'm not sure how to get the page to refresh wit...

I'm getting a NullPointerException when accessing static constraints

The code ${personRequest.constraints.requestStatus.inList} in my gsp file throws a NullPointerException, but "new PersonRequest().constraints..." works. Why? Isn't constraints static? ...

Why do Umlauts and special characters not show up correctly in my Grails pages?

How do I make sure the correct encoding (UTF-8) is used by Grails? ...

Startup Deployment Architecture- Running Glassfish V3 Prelude without Apache...

So am I crazy for considering doing a beta/production release on Glassfish V3 Prelude? Since all of my content is dynamic, I'm not even thinking of bothering to set up apache in front either. Doing so complicates the setup by requiring something like AJP or mod_jk and will not offer us much in terms of capability. So there will be thre...

What is the best practice for passing variables from one HTML page to another?

I'm relatively new to web application programming so I hope this question isn't too basic for everyone. I created a HTML page with a FORM containing a dojox datagrid (v1.2) filled with rows of descriptions for different grocery items. After the user selects the item he's interested in, he will click on the "Submit" button. At this...

Have a favorite custom Grails tag?

I've been using tags in my projects. I was browsing the custom tags on grails.org to find some new tags for my library. http://www.grails.org/Contribute+a+Tag I was wondering if people in the StackOverflow community have a favorite custom tag that they would like to share. ...

What is the best method to generating ranking lists for my website homepage?

What is the best way to generate and maintain several ranking lists for the home page of a website/webapp? e.g. hot posts, most recent posts, most comments, most consecutive wins etc. Currently, I'm thinking about using a cron job scheduler to run the queries to gather the statistics, run an algorithm on the statistics and then finally ...

Using Groovy/Grails in a legacy Java/JSP web app

I was fortunate enough to be able to start fresh with Grails. However, many people have asked me how to add Groovy and/or Grails to a legacy Java/JSP web app. Do people have experience or recommendations on how to best include Groovy and Grails into a large legacy application? ...

Best way to pretty print XML response in grails.

given this in a grails action: def xml = { rss(version: '2.0') { ... } } render(contentType: 'application/rss+xml', xml) i see this: <rss><channel><title></title><description></description><link></link><item></item></channel></rss> is there an easy way to pretty print the xml? something built into the render method,...

Best IDE for Grails/Groovy?

I am starting a project with Grails since I already use Eclipse, it was my first choice. But I don´t think its good enough, had some problems and the plugging is poor in functionalities. Anyone uses/tested others IDEs(NetBeans, InteliJ(not free)...)? Which one is the best? thanks. ...

How to share Domain objects on Grails with Ext GWT (GXT)?

Hi, My application is logically divided into server, which contain my Grails domain objects and controllers; and client, where I have my Ext GWT classes that build all the UI pages. For UI requests, I am using an AJAX call to a controller method that returns, for instance, a list of domain objects as a JSON structure. Following the DR...

Groovlet in Grails apps

How do I drop a Groovlet into a Grails app? Say, for example, in web-app/groovlet.groovy import java.util.Date if (session == null) { session = request.getSession(true); } if (session.counter == null) { session.counter = 1 } println """ <html> <head> <title>Groovy Servlet</title> </head> <body> Hello, ${requ...