gsp

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

爷,独闯天下 提交于 2019-12-19 20:51:06
问题 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

How to get current_user by using Spring Security Grails plugin in GSP

痞子三分冷 提交于 2019-12-19 08:13:28
问题 I am newbie in Grails. I am using Spring Security Grails plugin for Authentication purpose. I want to get current user in my view gsp file. I am trying like this ... <g:if test="${post.author == Person.get(springSecurityService.principal.id).id }"> <g:link controller="post" action="edit" id="${post.id}"> Edit this post </g:link> </g:if> Here I want to show Edit this post link to only those posts who created by signed_in user. But It showing ERROR - Error 500: Internal Server Error URI

Displaying image in GSP (Grails), get link from database

岁酱吖の 提交于 2019-12-18 17:58:11
问题 I'm a Grails newbie. I'm trying to show an images thumbnail for every product in a site, like this: <a href="#"><img src="${resource(dir:"images", file: "Nikon.jpg") }"/></a>/* 1 */ The problem here is that I want to save the image link in the database , and get the link by: ${fieldValue(bean: productInstance, field: "image")} /* 2 */ But I can't replace the /* 2 / code into the places of "Nikon.jpg" in / 1 */, it causes syntax error! After doing some research, I see that most tutorials show

Convert “[52.43242, 4.43242]” to google LatLng

情到浓时终转凉″ 提交于 2019-12-18 09:47:59
问题 i have a very simple question, I try to let google calculate the distance between an adress and a gsp-variable containing [53.57532, 10.01534] i´m not able to get variable ${center} to an google.maps.LatLng-Object heres the function jQuery(document).ready(function() { var result = '${center}'; console.log(result);// [53.57532, 10.01534] var origin = new google.maps.LatLng(55.930385, -3.118425); var destination = new google.maps.LatLng(result); var service = new google.maps

How can I change the way GRAILS GSP fieldValue formats Integers?

耗尽温柔 提交于 2019-12-18 03:43:10
问题 I have a field in my domain object which I define as an Integer... Integer minPrice I then access it in a GSP page as follows: ${fieldValue(bean: myBean, field: 'minPrice')} and what I get in my HTML is... 100,000 which is not an Integer, it's a String. Worse still it's a formatted String in a particular locale. This is a problem because I have a SELECT control on an HTML FORM which has a (non-ordinal) range of values for minPrice which I want to store in my domain object as integers, and I

Can't mark while showing the current location in 'mapview'

最后都变了- 提交于 2019-12-17 12:42:27
问题 Hear is my project In my project I am showing my current location,showing the current lat-long.But I'm not able to mark my current position in android. Thnx in advance. @Override public void onLocationChanged(Location location) { // TODO Auto-generated method stub Log.d(TAG, "onLocationChanged with location " + location.toString()); // Displays lat, long, altitude and bearing String text = String.format("Lat:\t %f\nLong:\t %f\nAlt:\t %f\nBearing:\t %f", location.getLatitude(), location

Can't mark while showing the current location in 'mapview'

寵の児 提交于 2019-12-17 12:41:18
问题 Hear is my project In my project I am showing my current location,showing the current lat-long.But I'm not able to mark my current position in android. Thnx in advance. @Override public void onLocationChanged(Location location) { // TODO Auto-generated method stub Log.d(TAG, "onLocationChanged with location " + location.toString()); // Displays lat, long, altitude and bearing String text = String.format("Lat:\t %f\nLong:\t %f\nAlt:\t %f\nBearing:\t %f", location.getLatitude(), location

grails: how to change compiled GSPs (gsp*.class files)?

旧时模样 提交于 2019-12-14 02:06:53
问题 I'm using grails in weblogic and need to change a class file in a exploded deploy folder. But this class is actually a gsp compiled file. So, the question is: where GSP files (.class) stay in a war ? Note: I'm using external GSPs, setting grails.gsp.view.dir in Config.groovy file. 回答1: Since Grails 1.3.5, you just have to set grails.gsp.enable.reload = true in Config.groovy or set a system property -Dgrails.gsp.enable.reload=true to the appserver (tomcat, etc.) startup. GSP reloading in WAR

Grails cannot invoke getTimeZone() on null object during unit testing of method of controller with render

孤街醉人 提交于 2019-12-13 17:58:10
问题 I'm having a problem unit testing my controller method. @Transactional def saveComment(){ BlogPost post = BlogPost.findById(params.id) Comment comment = new Comment(author:params.author,comment:params.comment) comment.save(flush:true) post.addToComments(comment) post.save(flush:true) post.refresh() render(template:'commentsTemplate', collection:post.comments.reverse()) } The problem comes when it tries to render the template. <div class="row"> <span> <font color="red"><b><span class="comment

Grails Cannot get property 'id' on null object

江枫思渺然 提交于 2019-12-13 16:32:53
问题 I am new to grails and I am getting this error: Cannot get property 'id' on null object I am trying to create a web application that displays fixtures in addition to adding new fixtures. However, when running the application I am unable to add fixtures or display the page that deals with adding the fixtures i.e add.gsp. Here are the classes that are currently available in my application. Here is my simple Fixture domain class: package cricketfixturesgrailsapp class Fixture { Date date String