FAQ Database Discussion Community


g:select value disappears after populating the select

grails,gsp
Im using g:select to that is populated with a list from controller! i pass the selected value as well from the controller when the select changed and submitted ! <g:select id="select" name="select" from="${someList}" value="${passedParameter_selectedValue}" noSelection="${['':'sth']}" optionValue='name' optionKey="id" /> When i debugged it so after submitting the values , my page...

why is g:link ignoring request params?

grails,gsp
In my Grails app, I have a URL mapped directly to a view in UrlMappings.groovy "/geolocation"(view: "/geolocation/index") I'm trying to generate a link to this view that includes request parameters with: <g:link elementId="btnSrcDest" uri="/geolocation" class="mapInfo" params="[mapType: 'foo']"> Click me </g:link> But this generates the following HTML <a class="mapInfo" id="btnSrcDest" href="/myApp/geolocation">...

Grails, Joda-Time plugin, TimePicker nullable not working

grails,jodatime,gsp
I have a domain class with the attributes start + end, both of them are LocalTime (Joda-Time plugin). I want the end Time to be nullable. For this purpose I used the following constraint: end nullable: true. Scaffolding is realized through the Joda template and it's working pretty good. The...

GSP in plain Spring MVC - AST Transformation is not applied to taglib

spring-mvc,grails,gsp
I am trying to run GSP views in simple Spring MVC application (without Spring Boot). I am trying to duplicate the example located here: https://github.com/grails/grails-boot/tree/master/sample-apps/gsp but I am trying to run it in plain Spring MVC environment. I have successfully reached the phase when GSP pages are rendered, some g:...

Render a Map of lists as a table in grails

grails,views,gsp
I have a controller which is passing on a hashmap to a view. The map has 3 elements, one of which is as below: -- A list of lists (A) in which list3 is a list of lists Now I want to display them on the gsp as follows: -----------------------------------------------------------------------------...

g:set tag inside template body in grails

grails,gsp
I using <g:set> tag inside g:render template body <g:render template="/template/panelContainer"> <g:set var="tomorrow" value="${new Date() + 1}"/> ${tomorrow} </g:render> _panelContainer.gsp: <div class="panel panel-default"> ${raw(body())} </div> However tomorrow variable is not set. How do I need to implement template to properly execute g:set tag? ...

How can I convert a i18next localized string to UpperCase

angularjs,gsp,i18next
I am working on a UI project using Groovy on Grails and AngularJS. For localization/internationalization we are using ng-i18next. Here I have a requirement to display the localized text in uppercase. There is a anchor tag in my .gsp file <a ng-href="${request.contextPath}/#/list">{{'locales.data.labels.summary' | i18next}}</a> This displays the text "Summary" after...

How can I pass data between GSP and controller in Grails without storing in the database?

grails,controller,gsp
Is it possible to enter data in the GSP view and use this data in the controller inside the program to do some operations without storing this data in the domain. For example I have a g:textField and I enter my name. I want to be able to use the...

Tag “Select” in gsp

grails,gsp
How to correctly use tag select in gsp while passing to it ArrayList<String> ? I know how to use it this my own composed objects, for example: <g:select name="tablePlacesAvailable" from="${tableInfo}" optionValue="${{it.placesInTableAmount}}" optionKey="placesInTableAmount" value=""/> But how to use it with built in objects, like String?...

Pass checkbox value to controller from GSP in Grails

grails,checkbox,gsp
I've a checkbox in my Grails application: <g:checkBox name="reservationAvailable" value="${cafeeInfo.isReservationAvailable}"/> It must be uncheked if isReservationAvailable boolean-value is false and checked if it's true. When I click on unchecked checkbox, it become checked, then I send a form, but in logs of controller I get false checkbox value. When I...

Adding text from property after each row in table gsp

html,grails,gsp
I want to add some text from an object property after each row of a table that contains a list of objects! each row presents some properties and i need to add text that is passed from a property as well ( in div or some other container) under each...

Grails: What is the difference between using actionName and pageScope.actionName inside taglibs?

grails,grails-2.0,gsp,taglib,grails-controller
In my company's codebase I'm seeing pageScope.actionName being used. Is it safe to droppageScope? Update: I am interested in knowing whether actionName is a late addition to the framework that makes pageScope.actionName obsolete. Update 2: Here is how it is used in one taglib: def url = "/${pageScope.controllerName}/${attrs.action}" ...

MissingMethodException in retrieving passed data through model attribute when rendering template gsp

java,grails,netbeans,gsp
I just recently started a Grails project in Netbeans. At some point, I need to pass parameters when rendering templates. I've searched here in stackoverflow on how to do that and the result is this code: <g:render template="/omm/placeOrders/buySellOrders/details/accountDetails" model="[show_sub_fieldset:'false']" /> And on that _accountDetails.gsp file, to fetch that passed value...

Unable to resolve class LocalTime grails

grails,jodatime,gsp
I need realize a time input in my Grails application. I've downloaded joda-plugin for it. But when I want test it, writing a such string from doc example: <joda:timePicker name="myTime" value="${new LocalTime()}" precision="second" />, I get such error: Unable to resolve class LocalTime How to fix it?

Send LocalTime object via parameters from gsp in Grails

grails,jodatime,gsp
I've input time field in my Grails application: <joda:timePicker name="startTimeReservation" value="${new LocalTime()}" precision="minute" /> I want to send its value to action in controller via parameters. This is a code from controller where I catch this value: oldCafeeInfo.startTimeLimit = params['startTimeReservation'] During parameters are send, I get a such error: Cannot...

Align g:form elements horizontally

css,gsp
Having a Grails/GSP issue. I want to horizontally align elements within a g:form tag. My code looks like this currently, though the submitButton is still below the textField. <g:form controller="objectSearch" action="search" > <g:textField name="searchText" value="${searchText}" /> <g:submitButton name="search" value="Search" /> </g:form> Thanks UPDATE: I've managed to get the desired result...

How to use i18n with a Grails radioGroup?

grails,radio-button,gsp
How does the message needs to be set in messages.properties to get the label translated? (I'm on Grails 2.4.4) Domain: int handledBy messages.properties: Case.handledBy.1=Handled by A Case.handledBy.2=Handled by B``` View: <g:radioGroup name="handledBy" values="[1,2]"> <tr class="prop"> <td valign="top" class="name"> <label><g:message code="${it.label}" />:</label> </td> <td valign="top" class="value ${hasErrors(bean:CaseInstance,field:'handledBy','errors')}"> ${it.radio} </td> </tr>...

my checkbox pass value even unchecked - Grails

grails,checkbox,gsp
I have lots of checkbox element on my Grails form, one is this: <g:checkBox id="consolidate" name="consolidate" value="${true}" checked="${false}" /> Then on the receiving controller, I verify the value of the checkbox using this code: println params?.consolidate And it displays: on Regardless whether I've tick my checkbox or not. In other...

Use a different layouts/main.gsp based on environment in Grails

grails,build,gsp
I am trying to have two distinct layouts for my application. Most of the changes are CSS based, however some elements might also get moved around(such as moving a navbar from the top to the side). I decided the easiest would be is to have two main layouts, and pick...

GSP form parameter appended to params - need overwrite

grails,groovy,gsp
I have the following form: <g:form controller="${controllerName}" action="${actionName}" params="${params}"> <g:select name="publisher_status" from="${['Active']}" value="${publisher_status}" noSelection="${[null:'No Filter']}" /> <button type="submit" class="btn btn-default btn-primary btn-sm ">Apply</button> </g:form> Each time I submit this form, publisher_status value is appended to the previous one, resulting in a list like publisher_status=[null,'Active'] etc. What I really need is...

Creating a back link using Grails

grails,gsp
I need to do "back" link in gsp page. How to realize it without using controllers and actions? For example via history-stack.

How to display value of map which is also a map in or