FAQ Database Discussion Community


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?

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...

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.

Grails: How to format date in language set in locale?

grails,gsp,date-formatting,formatdatetime
My multi-language Grails-based website has a switch for locale. I'd like to make sure date values are displayed in the locale set (and in the format currently being used in other outputs of scaffolding as the site is already available to the customer). Here's an example code I'm using: <g:formatDate...

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...

Display a at runtime changeable property on each site

grails,gsp
I want to display the name on every site of my grails app (this is not the app.name). Let's assume it is in the headline of the layout. <h1>My app name</h1> I would like to set this value at runtime and be able to edit it. My first idea was...

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...

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...

Grails domain object not refreshing in gsp

grails,gsp,grails-domain-class
I have a domain User, that hasMany queues. Adding and displaying queues works ok, but when i delete a queue from a user, the queue is deleted, but is still displayed in the browser. The view is refreshed only when i logout and login again. Where i remove them: def...

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...

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:...

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...

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}" ...

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...

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>...

Execute controller function in Grails via Ajax

javascript,jquery,ajax,grails,gsp
I am a novice with ajax in Grails. I want to try to execute a controller method from gsp-code from ajax. This is part of my gsp-code: <g:select optionKey="id" name="region.id" id="region" from="${region}" noSelection="[null:' ']" onchange="categoryChanged(this.value);" ></g:select> <div> <b>Sub-Category: </b> <span id="subContainer"></span> </div> <script> function categoryChanged(regionId) { $.ajax({type:'POST',data:'regionId='+regionId,...

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?...

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...

Grails Sending parameter from g:each to javascript

javascript,json,grails,each,gsp
What I need to do is show more information than the table size allow me to show. For that, I'm opening a jQuery Dialog with the whole information when the user mouse over the row he needs to see. The problem I have is when I pass the parameter from...

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...

Grails: Carry forward params on g:actionSubmit is clicked

grails,gsp
How to carry forward the parameters when g:actionSubmit button is clicked? Here is my gsp code: <g:checkBox name="msgCheck" checked="" value="${userInstance.emailId}"></g:checkBox> ... <g:actionSubmit class="update" action="delete" value="Delete" params="${params}"></g:actionSubmit> Here is my controller code: def delete() { try { def user_list = params.msgCheck //deleting the user //successful. redirect(action: "list", params: params) } catch...

Calling custom tagLib inside another custom tagLib dynamically

grails,dynamic,gsp,taglib
I have made two custom tagLibs, namely tabContainer and tab. def tabContainer = { attrs, body -> println("body: "+body()) out << '<div class="tab-content">' << body() << '</div>' } and def tab = { attrs, body -> out << '<div class="tab-pane '+${attrs.active == "true" ? "active" : ""}+'" id="'+attrs.id+'">' << body()...

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...

GSP template called once but rendered multiple times on UI

grails,gsp
Main GSP page where the call is made: <%@ page contentType="text/html;charset=UTF-8"%> <html> <head> <g:applyLayout name="main" /> <title>Power Forms - Finished Form Info</title> </head> <body> <div class="container"> <div class="row"> <div class="col-sm-12"> <h2> ${processDefinition.name} </h2> <div class="margin-top-5 margin-bottom-5"> <span class="label label-default"> ${processDefinition.getCategory()} </span> </div> <div...

How to pass params into Services that I get from the gsp and I have in my Controller in Grails

grails,service,gsp
I've got the params that a user enter in a g:textField in my controller when I call method save(), and I need to use this value in my services. How can I pass the params that I have in my controller to my services or is possible pass this data...

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: -----------------------------------------------------------------------------...

GSP Template fails to retrieve passed template from another template

html,grails,gsp
I'm working on a Grails 2.4.4 project. I have the following code on my gsp page (not a template) that calls a sub template that calls another template: main gsp page > gsp template > yet another gsp template: main.gsp ... <g:render template="/details" model="[param_one:'param_one', param_two:'param_two']" /> ... _details.gsp ... <p>On...

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