gsp

How to prevent Grails from caching old versions of gsp file?

故事扮演 提交于 2019-12-03 07:26:40
问题 I am making modifications to /grails-app/views/index.gsp. When I save the file and refresh http://localhost:8080/index.gsp in Firefox, I am getting an old version of the file. Is there a way to prevent Grails from caching and rendering old versions of the file? (I tried restarting the server and clearing Firefox's cache.) Thanks! 回答1: There doesn't seem to be a simple way to do this, but it's not much work. My solution subclasses the servlet that renders GSPs (and also the controller that's

gsp parameter passing from controller

◇◆丶佛笑我妖孽 提交于 2019-12-03 06:04:58
问题 how can i pass parameters to a groovy server page via a controller that are not an instance of a domain class ? 回答1: You put your parameters into the model object map returned to your GSP, for example: def index = { def hobbies = ["basketball", "photography"] render(view: "index", model: [name: "Maricel", hobbies: hobbies]) } Then you get those values accessing them by the name you use in your model map, for example: My name is ${name} and my hobbies are: <ul> <g:each in="${hobbies}" var=

Grails “render” renders the template

倖福魔咒の 提交于 2019-12-03 02:50:55
In my Grails controller I'm responding to an AJAX call and using render to return the text: def ajaxRandomPersonName = { def person = get a random person ... render "Name: ${person.name}" } The problem is that render renders the whole template. So instead of just rendering "Name: John" it renders all the icons, navigation, etc defined in the template. How do I get render to just render without the template? I'm pretty much following Chapter 1 of "Grails in Action" (page 28) using Grails 1.1.1. Follow up : Returning false per Rhysyngsun's suggestion has no impact. I also tried setting the

link directly to GSP

无人久伴 提交于 2019-12-03 02:12:20
In a GSP, is it possible to create a direct link to another GSP? I know I can use: <g:createLink controller="user" action="foo"/> and in UserController define the foo action to just show the corresponding GSP class UserController { def foo = {} } But is there any way I can achieve the same result without having to create the empty foo action? Thanks, Don The createLink tag is geared for use with controller actions and won't do what you want it to outside of the url attribute. You can always get to a gsp by directly: /user/foo.gsp with a combination of the link and resource tags. <g:link url="$

How to prevent Grails from caching old versions of gsp file?

扶醉桌前 提交于 2019-12-02 22:14:26
I am making modifications to /grails-app/views/index.gsp. When I save the file and refresh http://localhost:8080/index.gsp in Firefox, I am getting an old version of the file. Is there a way to prevent Grails from caching and rendering old versions of the file? (I tried restarting the server and clearing Firefox's cache.) Thanks! There doesn't seem to be a simple way to do this, but it's not much work. My solution subclasses the servlet that renders GSPs (and also the controller that's used for non-GSP requests). Here's the servlet subclass: package com.burtbeckwith; import java.io.IOException

gsp parameter passing from controller

好久不见. 提交于 2019-12-02 19:31:47
how can i pass parameters to a groovy server page via a controller that are not an instance of a domain class ? You put your parameters into the model object map returned to your GSP, for example: def index = { def hobbies = ["basketball", "photography"] render(view: "index", model: [name: "Maricel", hobbies: hobbies]) } Then you get those values accessing them by the name you use in your model map, for example: My name is ${name} and my hobbies are: <ul> <g:each in="${hobbies}" var="hobby"> <li>${hobby}</li> </g:each> </ul> That should display the following: My name is Maricel and my hobbies

remove & add select box option if other selection changes

人盡茶涼 提交于 2019-12-02 11:19:11
I have 3 select boxes and all are having same value (clones) & created on change of reference table selection. now i want to manage the selection on the three Constraint dropdown so that it 'Does not show the selected one in other two' and user cant select the same from two. how to do it in jquery? Code is - <tr> <td> Reference Table:</td> <td> <select id="tableCombo" onchange="jQuery.ajax({type:'POST',data:'tableCombo=' + this.value, url:'/GryphonMonitor /load/getColumns',success:function(data,textStatus) {jQuery('#columns').html(data);},error:function(XMLHttpRequest,textStatus,errorThrown) {

Recursion in GSP page

不羁的心 提交于 2019-12-01 20:57:31
I have a domain class Node { String nodeId String label Node parent } In the GSP page I want to start with the root and print all its children (note I have a reference to parent and not the child). Any idea how to do this ? I am sorry but I am new and really confused. I want to print everything going down from root(not root) and root has no parent(its null). So i have written <g:each in="${nodes}" var="node"> <g:if test="${node.parent!=null}"> ${node.label} <g:render template="node" model="[nodes:Node.findAllByParent(node)]" /> </g:if> </g:each> In the above code not sure what parent_node

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

人走茶凉 提交于 2019-12-01 20:04:18
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 surrounding method to access the variable. I already tried ${model.get('item'+i) , and ${params.get('item'+i) , but model is null and params is an empty Map. I also tried pageScope, but though I can access an item via ${pageScope.itemName , I can not use $

Where should I put javascript libraries in a Grails app?

久未见 提交于 2019-11-30 17:17:45
I have a couple of Javascript libraries of my own that do some nice prettyfying of my HTML pages and I want to include them in my gsp pages, particularly the landing page of my app. I have tried putting them in views folder and web-app/js and $APP_HOME/scripts but when I load my index.gsp the scripts don't show up. I have also tried a variety of alternatives in my code none of which work... <script src="mylib.js" type="text/javascript"></script> <script src="js/mylib.js" type="text/javascript"></script> <script src="scripts/mylib.js" type="text/javascript"></script> I'm sure there is a clever