gsp

How can I get a localized message in a grails GSP tag attribute?

In a grails GSP, I want a toolTip to be localized: <a href="..." title="localizedMessage"> As the toolTip is written in the attribute title, I can't use <g:message> here. Actually I already have a service for localized messages, but when I call it from the GSP, the service's messageSource is null, so getting that to work would be a so...

Grails GSP tab fieldValue formatting

How does the Grails tag fieldValue perform its formatting? I have an domain class with an Double attribute. class Thing { Double numericValue } In GSP, the fieldValue is used (as created by grails generate-all) for rendering: ${fieldValue(bean:thing, field:"numericValue")} Unfortunately digits after 3 decimal places are not di...

Grails/GSP: break out of <g:each>

Is there a way to break out of a <g:each>? I have a page wherein I'm iterating through a list and I have to make sure that a checkbox is checked if that was the value stored in DB. To make it a little clearer, please consider something like: <g:each in=${list1}> <g:each in=${list2}> <g:if test="${list1.id == list2.id}"> ...

Grails encoding problem Gsp. Help!

I'm with trouble on groovy server pages (gsp) where utf-8 chars are showing not propertly, like "?". But this occur inside grails tags like "${}". Example: <p>Não</p> --> output browser: Não - OK <g:link title="Avaliação Relatório"....> output browser: Avaliaç?o Relat?rio ${value? "Sim" : "Não"} output browser: N?o The gsp already...

Grails <g:actionSubmit> redirects to GSP instead of action

I have created a new action called "updateWithHistory" on a controller "X" similar to update. When I use this code from a scaffolded edit.gsp page: <span class="button"><g:actionSubmit class="save" action="updateWithHistory" value="${message(code: 'default.button.updateWithHistory.label', default: 'Persist')}" /></span> I get a 404 er...

Grails custom server page (custom gsp)

I have a controller and a gsp. I go ahead and attempt to build the project but receive issues on my gsp. It is telling me "The current scope already contains a variable of the name it" <html> <head> <title>Book Collector</title> <meta name="layout" content="main" /> </head> <body> <h1>Book Editor</h1> <table> ...

grails + get the next value in g:each

Hi everyone, I have a list of checkboxes like this: <g:each in="${mylist}" var = "item" > <tr> <td colspan="2"><g:checkBox value="${dimension.id}" name="${item.id}"/> - ${item.name}</td> </tr> </g:each> I have to alter it so I get 2 columns in each row (2 checkboxes per row) <g:each in="${mylist}" var = "item" > <...

Grails actions getting called twice. Help!

Hello community! I'm writing a grails app and running into a strange problem. When clicking the submit button on a page, the associated action gets called twice in rapid succession. This causes everything to break horribly. Has anyone else seen this issue before? Below is my code: From the GSP page: <g:form method="post" action="show"...

How to reference a grails GSP model variable indirectly e.g. via .get(...)

I'm using a GSP for sending out emails based on the MailService plug-in. The sendMail closure passes (amongst others) body(view:..., model:myModel) I know that I can access every item of the myModel Map just using ${itemName} in the GSP. However as I sometimes want to build the item name dynamically like 'item'+i, I need to have some su...

Grails interferes with jquery-tmpl syntax

The jQuery templates plug-in uses ${foo} syntax (example in jquery.tmpl doc): $.tmpl( "<li>${Name}</li>", myData ) But Grails also uses it (example in Grails doc): <body> Hello ${params.name} </body> So when I include $.tmpl( "<li>${Name}</li>", myData ) in my .gsp, Grails renders it as $.tmpl( "<li></li>", myData );. Is there a...

Grails how to access a variable from javascript

Hi I have a grails variable which is of type JASONList that is rendered in a template Is there a way to access this list from inside a javascript function. Lets say I want onresize to fit all the objects on the screen. Without making a db call and re fetching the entire list from ajax .... Lets say the template does something like ...

Grails/AJAX: Updating an arbitrary region in the page using g:submitToRemote

In a GSP (Groovy Server Page), I'm using <g:submitToRemote update="..."> to update a <div> after the server-side call. According to the tag's documentation and other sources on the web, the target <div> can be placed arbitrarily at the page. In my testings, however, I find that the <div> needs to surround the <g:submitToRemote> tag. I...

How to get a list parameter from a grails view

In my view I have the following: <g:hiddenField name='expandableEducationList[${edIdx}]._deleted' value='false'/> <button onclick="dojo.byId('expandableEducationList[${edIdx}]._deleted').value='true'; getContainer(this, 'tr').style.display='none'" style="width:auto;" iconClass="minusIconS...