gsp

How does one make a Grails application designer friendly without the need to re-deploy after a change to the view?

空扰寡人 提交于 2019-12-05 00:09:44
问题 It has been a long while since I have really worked with J2EE so please excuse my ignorance. My recent engagement in a Grails project has peaked my interest in Java once more and especially in Grails as it makes building web applications on the Java platform fun again. That being said, I would like an expert to comment on the following requirement that I have for an application built using Grails: The Design Team (web designers) require access to the GSP pages and edit the view files (layouts

Grails Render Template Different Controller/Path

大憨熊 提交于 2019-12-05 00:05:34
I have a template that exists under views/dashboard/_myTemplate.gsp and from the DashboardController I can simply call render template:'myTemplate' and all is well. I have a need to render this template from a different controller but the render method doesn't allow you to specify a controller and I can't seem to figure out how to define the path at which the template exists for the render to work correctly. Is this even possible? You do it by controller name: render(template:'/dashboard/myTemplate') 来源: https://stackoverflow.com/questions/3160367/grails-render-template-different-controller

Grails/GSP: break out of <g:each>

佐手、 提交于 2019-12-04 17:58:21
Is there a way to break out of a <g:each>? I have a page wherein I'm iterating through a list and I have to make sure that a checkbox is checked if that was the value stored in DB. To make it a little clearer, please consider something like: <g:each in=${list1}> <g:each in=${list2}> <g:if test="${list1.id == list2.id}"> <input type="checkbox" ... checked="checked" /> </if> </g:each> ... </g:each> where list1 is, say Domain1.list() (i.e. ALL possible values) and list2 is Domain2.find(...) (i.e. SELECTED values) In the g:each, I need to display ALL of list1 (hence, the "..." after the inner each

Grails iterating in gsp vs. accessing Map elements

时间秒杀一切 提交于 2019-12-04 13:33:09
Full context: I'm trying to process multiple files using a grails Application. The code I will display comes from the post-processing page where it gives information about the files processed. My initial sense was to use code like this: <table> <tr> <th>Parsed from Excel:</th> <th>Uploaded to DS:</th> <th>File Name:</th> <th>Size:</th> </tr> <tr> <g:each in="${fileContents}" var="item"> <td>${item}</td> </g:each> <%-- <td>${fileContents.ExcelRows?.encodeAsHTML()}</td> <td>${fileContents.policies?.encodeAsHTML()}</td> <td>${fileContents.originalFileName?.encodeAsHTML()}</td> <td>${fileContents

how can i render to the gsp view of other controller?

こ雲淡風輕ζ 提交于 2019-12-04 11:20:42
问题 I m new to grails,just started with a small application, I'm searching a solution for below problem, Can any one tell me how can i render to GSP view page of other controller from current controller view page. With advance Thanks, Laxmi.P 回答1: Lets suppose you want to render finalView.gsp of FirstController from normalView.gsp of SecondController having the following structure : FirstController.groovy finalView.gsp SecondController.groovy normalView.gsp normalView.gsp will have : <g:link

Grails: use controller from index.gsp

六眼飞鱼酱① 提交于 2019-12-04 03:17:46
i am new to grails and i want to use a method from a specific controller in my index.gsp In Index.gsp i tried <g:each in="${MyController.myList}" var="c"> <p>${c.name}</p> </g:each> but it says that the property is not available. MyController contains a property like: def myList = { return [My.findAll() ] } What am i doing wrong? Is there a good tutorial about the communication between the grails-parts? Or is there a better way to get information printed via gsp? Thanks ataylor Generally, when using the Model-View-Controller pattern, you don't want your view to know anything about controllers.

Why use <g:textField /> in Grails?

£可爱£侵袭症+ 提交于 2019-12-04 02:42:26
What is the reason to use g:textField in Grails if you're already familiar with standard HTML form tags? If I understand correctly the following two markup alternatives are equivalent: <input type="text" name="name" value="${params.name}" id="name" /> <g:textField name="name" value="${params.name}" /> Are there any circumstances under which using g:textField would add value? Am I missing something? The textField tag is provided as a convenience (slightly shorter than writing the HTML input) and is there to provide a full set of form tags. Personally I prefer to write as much plain HTML as

How does one make a Grails application designer friendly without the need to re-deploy after a change to the view?

泪湿孤枕 提交于 2019-12-03 15:45:49
It has been a long while since I have really worked with J2EE so please excuse my ignorance. My recent engagement in a Grails project has peaked my interest in Java once more and especially in Grails as it makes building web applications on the Java platform fun again. That being said, I would like an expert to comment on the following requirement that I have for an application built using Grails: The Design Team (web designers) require access to the GSP pages and edit the view files (layouts, templates, etc.) without bothering the development team (software developers). This scenario can take

link directly to GSP

早过忘川 提交于 2019-12-03 11:51:04
问题 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 回答1: 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

Mailing Exception logs in a live Grails webapp

白昼怎懂夜的黑 提交于 2019-12-03 10:17:00
问题 I'd like my Grails web-app to send an e-mail for each exception that reaches the end-user. Basically I'm looking for a elegant way to achieve something equivalent to: try { // ... all logic/db-access/etc required to render the page is executed here ... } catch (Exception e) { sendmail("exception@example.com", "An exception was thrown while processing a http-request", e.toString); } 回答1: Turns out this exact question was answered on the Grails mailing list a couple of days ago. The solution is