FAQ Database Discussion Community

Render a Map of lists as a table in grails

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

MissingMethodException in retrieving passed data through model attribute when rendering template 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...

Grails domain object not refreshing in gsp

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

GSP template called once but rendered multiple times on UI

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

Creating a back link using Grails

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

Grails Sending parameter from g:each to javascript

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

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

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

showing null point exception when findAllBy - for session object

I have already checked that session.parent_id and session.id_of_project is not null in the below code in gsp <g:if test="$session.parent_id"> <g:set var="permission" value="${Project_permission.findAllById_of_projectAndParent_id(session.id_of_project, session.parent_id)}"/> <g:each var="emp" in="${permission}"> <g:set var="employee2" value="${Employee.findById(emp.id_of_employee)}"/> <li class="parent_li"> <span class="badge red" title="Collapse this branch"> <i class="fa fa-minus-sign">...

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

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

g:select value disappears after populating the select

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

How can I convert a i18next localized string to UpperCase

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: How to format date in language set in locale?

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

my checkbox pass value even unchecked - Grails

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

Grails, Joda-Time plugin, TimePicker nullable not working

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 form parameter appended to params - need overwrite

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

Display a at runtime changeable property on each site

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

Unable to resolve class LocalTime grails

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?

Tag “Select” in 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?...

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

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

Align g:form elements horizontally

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

Send LocalTime object via parameters from gsp in Grails

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

why is g:link ignoring request params?

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

Adding text from property after each row in table 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: Carry forward params on g:actionSubmit is clicked

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

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

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

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