gsp

HTML&GRAILS - urls text is not displayed as hyperlink

戏子无情 提交于 2019-12-12 03:19:26
问题 I have the following gsp code: <p class="common-text ">${direction?.description?.toHtml()?.decodeHTML()}</p> direction?.description is a text which the user entered in some input field. This text could includes website URLs like Visit my new site www.example.com How can I verified if some of the text contains a URL, and if so display it as hyperlink? The text above should be transformed to something like: Visit my new site <a href="www.example.com"> www.example.com </a> 回答1: You have two way

Grails GSP Loop through an index and do somthing with selected lines

本小妞迷上赌 提交于 2019-12-12 03:09:16
问题 In an Index-gsp, I want to be able to select an arbitrary number of lines and then by clicking a link send all those lines to a controller for processing e.g. creating new objects of a different kind. I've no idea how selection can be done or how to collect these selected lines in a GSP. Maybe I should use a checkbox on each line if that's possible? It's a list of products which is displayed using a modified index.gsp. Each product-line has a checkbox in front. What I want is to make a list

Grails: use list in Controller and View

限于喜欢 提交于 2019-12-12 02:58:38
问题 class Candidate { String username; static HasMany=[applications:Application] } class Vote { String name; Date firstdate; Date enddate ; static HAsMany=[applications:Application] } class Application { Date datedemand; Candidate candidate; Vote vote; static belongsTo = [candidate:Candidate,vote:Vote] } I want to display the list of votes and if I click on a vote, it displays the list of candidates for this vote. I started ​​the following attempt, and I remain blocked : def candidatsGrpByVte(){

Is it possible to change table row colour if it contains a certain value in a gsp?

笑着哭i 提交于 2019-12-12 02:56:37
问题 I have a table in a gsp containing 10 deiiferent values : <table class="table table-striped"> <tr> <th scope="row">Name:</th> <td> ${person.name} </td> </tr> <tr> <th scope="row">Address:</th> <td> ${person.address} </td> </tr>............ I need to highlight (either change the background or text clour on some of the values if they are present in an array also available in the gsp. Is this possible? For example using g:if? Like : <tr> <th scope="row">Name:</th> <td> <g:if ${array}.contains("$

hide various buttons with different div Javascript within a form

*爱你&永不变心* 提交于 2019-12-12 02:53:53
问题 this is my code press to hide , then press to display <script type="text/javascript"> var clic = 1; function hideFecha(){ if (clic == 1){ document.getElementById('fecha').style.display='none'; clic = clic + 1; } else { document.getElementById('fecha').style.display = 'block'; clic = 1; } } </script> //press to hide , then press to display <script type="text/javascript"> var click = 1; function hidePerson(){ if (click == 1){ document.getElementById('person').style.display='none'; click = click

how to convert raw br in gsp to break row?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 02:38:29
问题 In my gsp page is the following code <p> ${ confirmationTemplate?.body?.replace('\n', '<br/>') } </p> The page renders as follows > Dear Participant, <br/> <br/>Thanks for registering to our event. The > event will start shortly. <br/> <br/>Please collect your bibs before > the race. <br/> <br/>Cheers, <br/>Swat Kats The < br/> should not be printed but that should cause new line. How can i solve this problem? I appreciate any help! Thanks! 回答1: <%request.setAttribute("vEnter", "\n");%> ${fn

gsp, groovy, encodeURI component, inline javascript

被刻印的时光 ゝ 提交于 2019-12-12 01:02:17
问题 i have a problem with this each loop i have a select, you choose an option, press a button and the selected value is beamed via ajax as encodeURIcomponent to the backend, the answer updates this ul : <g:each in="${items}"> <li class="${fieldName}_item" >${it}<span onclick="deleteItem('${fieldName}','${id}','${reloadForm}', '${it}');" class="editdropdel ${fieldName}_button"></span></li> </g:each> as soon as ${it} contains special characters like " "" " the inline stuff is broken, is there

how to properly render checkboxes and get a list of which checkboxes have been selected in Grails

北城余情 提交于 2019-12-11 23:34:26
问题 I have tried for over a month get the correct rendering, binding and listing of selected checkboxes in grails (please see this link: How to get a list of checked boxes in grails). I can get a list of checkboxes from the controller with this code: package frametest import groovy.io.FileType class Read_dirController { def index() { def list = [] def dir = new File("/Users/ironmantis7x/Documents/business/test_files/APITest/utils") dir.eachFileRecurse (FileType.FILES) { file -> list << file }

Passing params from within <g:each> to action specified in createLink within a javascript function, called on clicking <a:> link

醉酒当歌 提交于 2019-12-11 23:28:35
问题 I have a template containing a g:each that renders a set of search results in tabular format as follows: <g:if test="${company}"> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="small"><g:message code="Company Name"/></th> <th class="medium"><g:message code="TDCID"/></th> <th class="tiny"><g:message code="STREET"/></th> </tr> </thead> <tbody> <g:each in="${company}" status="idx" var="PNo"> <tr> <td> <a: href="javascript:void(0)" onClick="javascript:asd();" params="[tdc:PNo

How do you get Grails gsp support for Java localdatetime

十年热恋 提交于 2019-12-11 20:39:25
问题 I am running Grails 3.3.8 with Java 8.v181. I have a included hibernate-java8 and grails-java8 plugins, in build.gradle //needed for java local datetime features set compile "org.grails.plugins:grails-java8" compile "org.hibernate:hibernate-java8" I have a domain class like this import cmdb.Customer import java.time.LocalDateTime class ServiceRequest { //Long id String requestIdentifier Customer customer String customerSummary String status LocalDateTime dateCreated = LocalDateTime.now()