B
boliviab
Guest
Hi
I created a GSP called showTomorrowsReservations.gsp that was a copy of my index.gsp but with an additional section that called an action in the reservation controller to show reservations I had that started tomorrow. I got that working fine when accessing via reservation/showTomorrowsReseravations url. So I decided to try take the code I wanted to show (that was additional to the original index.gsp) and put it in a template called _showTomorrowsReservations.gsp and call this from the index with the line
(ive also tried a few variation of the model with quotes, etcto see if that was the issue)
but I always get the error:
Class
org.codehaus.groovy.grails.web.mapping.exceptions.UrlMappingException
Message
Unable to create URL for mapping [/(*)/(*)?/(*)?(.(*))?] and parameters [{sort=id, order=desc, action=list}]. Parameter [controller] is required, but was not specified!
The code works when using the /reservation/showTomorrowsReservations url so I know teh controller code is correct but I will port here also to give the whole picture
Reservation Controller Action Code:
_showTomorrowsReservations.gsp Code:
Im trying to work out why it is not working and am hoping someone can tell me why. I should also mention that I am using spring security which could be causing the issue? I have added
into the grails.plugin.springsecurity.controllerAnnotations.staticRules in Config.groovy to see if that helps and also have grails.plugin.springsecurity.rejectIfNoRule = false set , but still have errors.
I created a GSP called showTomorrowsReservations.gsp that was a copy of my index.gsp but with an additional section that called an action in the reservation controller to show reservations I had that started tomorrow. I got that working fine when accessing via reservation/showTomorrowsReseravations url. So I decided to try take the code I wanted to show (that was additional to the original index.gsp) and put it in a template called _showTomorrowsReservations.gsp and call this from the index with the line
Code:
<g:render template="/reservation/showTomorrowsReservations" model="[reservationsList:reservationsList]" />
but I always get the error:
Class
org.codehaus.groovy.grails.web.mapping.exceptions.UrlMappingException
Message
Unable to create URL for mapping [/(*)/(*)?/(*)?(.(*))?] and parameters [{sort=id, order=desc, action=list}]. Parameter [controller] is required, but was not specified!
The code works when using the /reservation/showTomorrowsReservations url so I know teh controller code is correct but I will port here also to give the whole picture
Reservation Controller Action Code:
Code:
def showTomorrowsReservations(){
def today = new Date()
def tomorrow = today +1
List<Reservation> reservationsList = Reservation.findAllByStartDateBetween(today, tomorrow, [max:50, offset:0])
[reservationsList:reservationsList]
}
_showTomorrowsReservations.gsp Code:
Code:
<%@ page import="net.XXXXXtours.Reservation" %>
<div id="list-tomorrowsreservations" class="content scaffold-list" role="main">
</br></br>
<center><h3> TOMORROWS RESERVATIONS </h3></center></br>
<table>
<th>Customer</th>
<th>Product</th>
<g:sortableColumn property="id" defaultOrder="desc" title="PO Code" />
<g:sortableColumn property="wocode" title="WO Code" />
<g:sortableColumn property="startDate" title="Start Date" />
<g:sortableColumn property="endDate" title="End Date" />
<g:sortableColumn property="issueDate" title="Issue Date" />
<g:each in="${reservationsList}" status="i" var="reservation" controller="reservation">
<tr class="${(i % 2) == 0 ? 'even' : 'odd'}">
<td><g:link action="show" id="${reservation.id}">${reservation.customer}</g:link></td>
<td>${reservation.product}</td>
<td>KT0${reservation.id} </td>
<td>${reservation.wocode} </td>
<td><g:formatDate format=" dd/MM/yy" date="${reservation.startDate}" /></td>
<td><g:formatDate format=" dd/MM/yy" date="${reservation.endDate}" /></td>
<td><g:formatDate format=" dd/MM/yy" date="${reservation.issueDate}" /></td>
</tr>
</g:each>
</table>
</div>
Im trying to work out why it is not working and am hoping someone can tell me why. I should also mention that I am using spring security which could be causing the issue? I have added
Code:
'/**/reservation/**': ['permitAll']