gsp

How To Implement Adding An Extra Parameter in Grails Pagination?

I have a page/gsp that displays 3 different classes. This means that I need to add extra parameters to the pagination links. currently the link auto generated by default pagination tag in grails produces links like this: http://localhost:8080/Teams/Leader/assignFollower?offset=400&max=100 I'd like it to be something similar t...

How do you update a TextField from a grails remoteLink?

Existing markup: <g:textField name="identifier"/> <g:remoteLink action="newId" update="identifier">generate new id</g:remoteLink> Corresponding HTML markup: <input type="text" id="identifier" name="identifier"> <a onclick="new Ajax.Updater('guid','/webapp/domain/newId',{asynchronous:true,evalScripts:true});return false;" href="/webap...

How do you nest g:each tags in gsp?

Assume I have the following classes class Genre { static hasMany=[author:Author] } class Author{ static hasMany=[books:Books] } class Books{ Author author } How do I go about printing this in the gsp using g:each tag? ...

How do I nest ${} in gsp

This is in my gsp and it doesn't work <g:select name="head.id" from="${com.hive.Persons.findAllByFirstname(${variable})}" optionKey="id" value="${organizationInstance?.head?.id}" /> I think that the main reason is that I am nesting ${}. How can I accomplish this. ${variable} is a string passed from the controller. thanks! ...

How to Alphabetically retrieve members of a list?

I have an organization class class Organization { hasMany = [member:Members] } class Members { belongsTo = organization } I'm printing all the members using <ol> <g:each in="${organizationInstance?.members?}" var="m"> <li><g:link controller="members" action="show" id="${m.id}">${m?.encodeAsHTML()}</g:link></li> </g:each> </ol> ...

Gorm findAllBy inside gsp doubt

Hi, can anybody tell me why this works <g:each var="n" in="${com.pp.News.list()}"> <h2>${n.t}</h2> <p>${n.tx}</p> </g:each> but this doesn't ? <g:set var="news" value="${com.pp.News.findAllByShow(true,[sort:'prio', order:'desc',max:5])}" /> <g:each var="n" in="news"> <h2>${n.t}</h2> <p>${n.tx}</p> </g:each> Part of the e...

Problem calling grails service from gsp

Hi, how can I invoke a service directly from a view ? I'm trying with ${my.domain.service.method} but it complains it can't find the property. And no, I don't want to use a controller because the view is a template. Thanks ...

GSP rendering programatically

Suppose I have a gsp snippet stored in my database. How do I programatically merge it with a data model to produce a string. ...

Compiling a groovy template to a class file i tomcats work dir

I just installed tomcat (6.0.20) with groovy-all.jar (1.7.2) in my WEB-INF/lib My web.xml file looks like this <web-app> <servlet> <servlet-name>Groovlet</servlet-name> <servlet-class>groovy.servlet.GroovyServlet</servlet-class> </servlet> <servlet> <servlet-name>Template</servlet-name> <ser...

Problem with variable inside gsp

Hi, I have a loop inside a gsp page, and I want to do a calculation on the fly, so I set a variable: <g:set var="total" value="0" /> And in the loop: <g:each in="${mob}" var="m"> ... <g:set var="total" value="${total+(m.q*m.sts.uf)}"/> ... </g:each> The "total" value does not correspond to the expected calculation. m.q is an...

println in grails gsp file

I know this is simple thing, but i was not aware. I used println in gsp file and expected to print output in console. But this is showing on page. <% for(int i =0; i < threads.size();i++) { println i } % thanks. ...

How to use more parameters in help-ballon grails-plugin

I try to use more of the parameters but could not get it working with <g:helpBalloon title="foo" content="bla" useEvent="['mouseover']" /> should result in <script type="text/javascript"> new HelpBalloon({ title: 'foo', content: 'bla', useEvent: ['mouseover'] }); </script> but useEvent="['mouseover']" seems not to be recognized?! ...

grails gsp test evaluates to false, but block is still rendered. Why?

I'm baffled with Grails test operator. This expression: <g:if test="${!(preferences.displayOption.equals('ANA') || preferences.displayOption.equals('FLOP'))} "> ${!(preferences.displayOption.equals('ANA') || preferences.displayOption.equals('FLOP'))} </g:if> prints false How can that be? I'm printing the exact same condition I...

Grails pattern to reuse template on error

Hello, I have a gsp template, where the data for create view is passed through the controller. def create = { def bookInstance = new Book() bookInstance .properties = params def map = getDefaultValues() render(template: "create", model: [bookInstance : bookInstance , title: map.title, somelist: somelist ...

grails and flash movie

Is it possibe to insert into GSP simple flash movie? I tried this way: <object type="application/x-shockwave-flash" data="${resource(dir:'flash',file:'movie.swf')}" width="400" height="400"> <param name="movie" value="${resource(dir:'flash',file:'movie.swf')}" /> <param name="bgcolor" value="#ffffff" /> ...

Is there a way to do gsp partials rather than tag libraries?

One of the things I liked about freemarker is that you can quickly create new macros that encapsulate complex html to make the pages smaller and more concise. Do I have to make tag libraries to do the same thing in grails, or is there a really light-weight syntax for achieving the same thing? ...

How do you setup an gsp snippet in grails and with spring-security-core?

Hi, I have a block of gsp I'd like to reuse and make into a little gsp snippet: <sec:ifLoggedIn> <g:link controller="user" action="showProfile">My Profile</g:link> | <g:link controller="privateMessage" action="list">Inbox</g:link> | <g:link controller="user" action="showPreferences">Preferences</g:link> | <g:link control...

Grails GSP tag to submit form with link?

I'd like to submit a form using a link instead of a submit input. Is there a tag in Grails that does this? ...

Documentation about difference between javacript src and javascript library in grails

I know that if you write in a view: <g:javascript src="myscript.js" /> <g:javascript src="myscript.js" /> <g:javascript src="myscript.js" /> <!-- other try --> <g:javascript library="myscript" /> <g:javascript library="myscript" /> <g:javascript library="myscript" /> It will out output: <script type="text/javascript" src="/vip/js/my...

Grails: Getting current View name from within a Taglib.

Is there any way too find out the current view (or gsp file) that is being executed? RequestURI doesn't work due to URL Mappings and forwards. I'm trying to retrieve resources dynamically based on the currently executing GSP file. For example, if product/view.gsp is being executed, I want to include product/view.css and product/view.js...