gsp

Grails grailApplication.controllerClasses sort controller by package

你。 提交于 2019-12-13 07:41:31
问题 I have the following code that grabs all controllers, sorts it, and outputs in li tags: <g:each var="c" in="${grailsApplication.controllerClasses.sort { it.fullName } }"> <li<%= c.logicalPropertyName == controllerName ? ' class="active"' : '' %>> <g:link controller="${c.logicalPropertyName}">${c.naturalName}</g:link> </li> </g:each> I have a need to filter out controllers by package i.e. grab controller from a certain package. For example: com.app.module.mars.controller.HelloController com

Can't call method itself in grails

橙三吉。 提交于 2019-12-13 07:38:01
问题 I got an error in my project when I try to call method it self inside body of method. I put my code in gsp. here they are /* Method for appending the child menu */ def createMenuChild = { obj , paramMenuArr -> def urlChildMenu=obj.menu.url def idChildMenu=obj.menu.id def nameChildMenu=obj.menu.name out << '<div><a href="'+urlChildMenu+'" class="mChld">'<< nameChildMenu<< '</div>' def childInstance1= Menu.findById(idChildMenu) def child1MenuInstance= Menu.createCriteria().list{ eq("parentMenu"

Display last 10 characters only

爷,独闯天下 提交于 2019-12-13 05:16:48
问题 I am using an EL to display a String in my GSP. ${grails.util.Holders.config.dataSource.url} I would like to only display the last ten characters. Any ideas on how I do this? Thanks 回答1: ${grails.util.Holders.config.dataSource.url[-10..-1]} See docs: http://groovy.codehaus.org/JN1525-Strings 来源: https://stackoverflow.com/questions/19134649/display-last-10-characters-only

Grails g:link button appears larger than other buttons

痴心易碎 提交于 2019-12-13 04:51:34
问题 I have a page that shows details of a bookInstance. On that page I want to put a button that uses a g:link to show some additional details. I've got code that works mechanically, but the button doesn't appear correctly. The button's box doesn't shrink to the size of the content and there's a funny line added to the right hand side of the button. Here's the code I'm currently using; <g:form> <p><g:actionSubmit class="button" action="edit" value="${message(code: 'default.button.edit.label',

Grails formRemote: specifying real url as parameter

走远了吗. 提交于 2019-12-13 04:45:27
问题 I'm trying to use the Grail formRemote tag. I'm using it like so: <g:formRemote name="newRule" url="https://somesite/somescript"> 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 types: (java.lang.String) values: [https://somesite/somescript] How do I specify a real URL in this field instead of a map with controller, action, etc... ? 回答1: Have you

Grails elfinder plugin not working

邮差的信 提交于 2019-12-13 03:28:29
问题 I want to use a file manager in Grails (2.3.11) and found the elfinder plugin. I've read the docs and a related SO answer and still the manager does not render on my page. Here is the relevant parts of code. Hopefully someone can help. Here is my index.gsp <!DOCTYPE html> <html> <head> <meta name="layout" content="main"/> <title>File manager</title> <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/themes/smoothness/jquery-ui.css"/> <link rel=

request variables in grails

我怕爱的太早我们不能终老 提交于 2019-12-13 01:54:02
问题 EDIT : based on feedback, erased original Q. completely and reposting in better language I wish to access a request or params variable and pass it between the controller and the gsp. i understand that the params object contains everything that a querystring has. All the examples I see are all Model driven. I have looked up docs online and I have two books - beginning-grails and definitive guide to grails, both have database driven examples on params. I want to understand how params can be set

How do I get the CSS fonts to work with this Grails PDF rendering plug-in?

两盒软妹~` 提交于 2019-12-12 18:07:38
问题 I am using a Grails rendering plugin to generate PDF. I want to include CSS with my PDF to render it nicely. I found an example on the rendering plugin website I put the CSS below in print media so that it works for PDF, but this does not work for me. I also do not know how to change the font from Arial to another font. Can someone explain this to me? The plugin uses Arial font with this CSS: @font-face { src: url(path/to/arial.ttf); -fs-pdf-font-embed: embed; -fs-pdf-font-encoding: cp1250; }

params values are always null in controller on clicking <g:actionSubmit> button

空扰寡人 提交于 2019-12-12 04:43:51
问题 In my application, I have search button and based on the search criteria, I have to search data. I have used few hidden variables to store data. My .gsp page looks like this: <g:form id="job" name="job" method="POST"> <div> <input type="hidden" id="country" name="country" value="${country}"/> <input type="hidden" id="paginationFlag" name="paginationFlag" value="${paginationFlag}"/> <!-- There are other components like text field, select box etc --> <g:actionSubmit id="Search" value="Search"

How to display different flash.message in different style in GSP page

浪尽此生 提交于 2019-12-12 03:57:48
问题 I have to display different messages using flash.message, some of them have to be in different color, So How to distinguish the flash.message and display them in different color in GSP 回答1: the view page code to view error and suces msg in different style <g:if test="${flash.message}"> <div class="message" role="status" style="font-size: medium;color: green;">${flash.message}</div> </g:if> <g:if test="${flash.warning}"> <div class="message_error" style="font-size: medium;color: red;">${flash