gsp

Groovy paginate problem

Hi, I have an application written in groovy and I am having problems with the pagination of a resulting set. I have a Controller called ReportingController. This controller has two methods called listdoiTln and listdoiEv. Both methods are similar and at the end both have to render a list of reports. The last lines of both are as follows...

Groovy findAll and each tag question

Hi I have the following domain classes: class User = { String username ... Company company } class Company { String name ... } That is, there is a n:1 relationship between user and company. These classes are so and I cannot change them. At the show.gsp I want to have the details of the company togethe...

How to define in Grails an uploadForm and 2 different actions ?

I have a gsp view, with an , and 2 input text. I have a button to save and submit. Now I would like to add another button with a new action, in my case a button to schedule save. Note : in my controller I have define : def save (corresponding to button action save) and def schedule (corresponding to button action schedule). What is th...

TDD grails views

I want to write a gsp file that takes a domain object and generates KML. I want to verify that specific elements are present depending on the domain object contents. How would I TDD this gsp file? I was thinking about writing a test that called the render method with a domain object but not sure how to call the render method from outs...

Does anyone have a TextPad syn file for GSP?

I am looking for a syntax hilighting file for Textpad which hilights the Groovy g namespace. I have been trying to build one myself and can't quite figure out how to do it - or whether it is possible to have namespace based syntax hilighting in TextPad at all. I have a great one for Groovy, but nothing yet for GSP. Has anyone created ...

Where should I put javascript libraries in a Grails app?

I have a couple of Javascript libraries of my own that do some nice prettyfying of my HTML pages and I want to include them in my gsp pages, particularly the landing page of my app. I have tried putting them in views folder and web-app/js and $APP_HOME/scripts but when I load my index.gsp the scripts don't show up. I have also tried a ...

Basic Grails question: How does the following Grails code define personInstance?

This is the GSP code generated by Grails for the view of the edit action for a Person domain object which is part of my model, and also happens to be the primary class for authentication by the ACEGI security plug-in. I have snipped out a bunch of properties to keep it short. The file resides in the standard location, grails-app/views/...

Groovy Grails - how to read body contained within tag?

I'm considering reading the body of a tag to determine what variables the tag should send to the body. e.g, here's the GSP <g:get_domain_info id="${patientInstance?.id}" > <tr class="prop"> <td valign="top" class="name"> ${firstNameLabel}</td> <td valign="top" class="value"> ${firstNameValue}</td> </tr> </g:get_domain_info>...

Correctly pass a Groovy list to Javascript code in GSP

I'm making a web application with Grails. I've got a list with data that must be included on JavaScript to perform some dynamic load on drop-list. Basically, I'm getting a two level list from the server, then the first level is presented on a drop box. When the user selects an option, the list associated to this option is presented on a...

How to check for resource file existence at run-time [grails]?

I need to test whether a resource file (an image, for instance) exists and if not, I will display another image. My GSP view code looks like: <% if (resExists(dir: "images", file:"img.jpg")) {%> <img src="${g.resource(dir:'images',file: 'img.jpg')}"> <% else { %> <img src="${g.resource(dir:'images',file: 'noimg.jpg')}"> <%}%> How ...

Why does grails add a hidden checkbox to a form - and what does it do with it?

I have a checkbox on my GSP page as follows (which was stolen directly from the scaffolded "create" code for my domain object)... <tr class="prop"> <td valign="top" class="name"> <label for="isSelling"><g:message code="person.isSelling.label" default="Is Selling" /></label> </td> <td valign="top" class="value ${hasErrors(bean: personI...

Adding search/filter to a scaffolded list.gsp

Hi, I've been looking in some of the latest Grails books and many open source projects for samples and best practices for adding search/filter functionality to scaffolded list.gsp:s, eg making it work with pagination and sorting etc. This may be a simple task, but being a Grails newcomer it would be of great benefit in having some thorou...

How can I change the way GRAILS GSP fieldValue formats Integers?

I have a field in my domain object which I define as an Integer... Integer minPrice I then access it in a GSP page as follows: ${fieldValue(bean: myBean, field: 'minPrice')} and what I get in my HTML is... 100,000 which is not an Integer, it's a String. Worse still it's a formatted String in a particular locale. This is a prob...

How do I save a composite field value in Grails GSP?

I have a composite domain object as follows: class Person { static embedded = ['forSale'] Boolean isSelling House forSale } class House { Integer numBedrooms } I have a select control for the numBedrooms as follows: <tr class="prop"> <td valign="top" class="name"> <label for="numBedrooms"><g:message code="perso...

How does one make a Grails application designer friendly without the need to re-deploy after a change to the view?

It has been a long while since I have really worked with J2EE so please excuse my ignorance. My recent engagement in a Grails project has peaked my interest in Java once more and especially in Grails as it makes building web applications on the Java platform fun again. That being said, I would like an expert to comment on the following r...

Grails - check if item has parent

I'm new to Grails, Groovy and GSP. I have a domain class "ProductCategory". class ProductCategory { static constraints = { } static mapping = { table 'product_category'; version false; cache usage: 'read-only'; columns { parent column: 'parentid'; procedure column: '...

link directly to GSP

Hi, In a GSP, is it possible to create a direct link to another GSP? I know I can use: <g:createLink controller="user" action="foo"/> and in UserController define the foo action to just show the corresponding GSP class UserController { def foo = {} } But is there any way I can achieve the same result without having to create t...

Grails formRemote: specifying real url as parameter

I'm trying to use the Grail formRemote tag. I'm using it like so: <g:formRemote name="newRule" url="https://somesite/somescript"&gt; However, I keep getting the error: groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.grails.plugins.web.taglib.JavascriptTagLib.deepClone() is applicable for argument typ...

GSP Editing in Netbeans 6.8

Hello guys. I have a problem with Netbeans 6.8 and GSP pages. Format and indent working but provides invalid structure. Moreover Netbeans highlinging page directive as error. And code completion is not working too. Is it a bug or smth need to be fixed in my settings or Netbeans does not provide such features. In this archive you can ...

Rendering HTML files in Grails

Hi all, I've looked around but could not find a way of simply including or rendering *.html files in Grails. My application needs to g.render or <g:render> templates which are delivered as html files. For this, as we know, html files have to be converted to _foo.gsp files in order to get rendered. I am totally surprised as to why isn't ...