error appears when i add anything in my controller

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

error appears when i add anything in my controller

sshehab

Hi all , 

i'm using Grails 2.5.1 on Windows 7 64 bit , After generating the controllers and the views using Grails command

generate-all "*"

When i add any new lines in my controllers i get the below error : 


Compilation error: startup failed:



E:\Development\eclipse\TekDays\grails-app\controllers\com\tekdays\TekEventController.groovy:
47: Ambiguous expression could be a parameterless closure expression, an
isolated open code block
, or it may continue
a previous
statement
;



   solution:
Add an explicit parameter list, e.g. {it -> ...}, or force it to be treated
as an open block by giving it a label, e.g. L:{...}, and also either remove the
previous newline
, or add an explicit semicolon ';'
@ line 47,
column
4.


           {



      ^

1
error


here is my controller : 



package com.tekdays
 
import static org.springframework.http.HttpStatus.*
 
@Transactional(readOnly = true)
class TekEventController
{
    def taskService // this what i added
    static allowedMethods = [save: "POST", update: "PUT", delete: "DELETE"]
 
    def index(Integer max)
    {
        params.max = Math.min(max ?: 10, 100)
        respond TekEvent.list(params), model:[tekEventInstanceCount: TekEvent.count()]
    }
 
    def show(TekEvent tekEventInstance)
    {
        respond tekEventInstance
    }
 
    def create()
    {
        respond new TekEvent(params)
    }
 
    @Transactional
    def save(TekEvent tekEventInstance)
    {
        if (tekEventInstance == null)
        {
            notFound()
            return
        }
 
        if (tekEventInstance.hasErrors())
        {
            respond tekEventInstance.errors, view:'create'
            return
        }
 
        tekEventInstance.save flush:true
        taskService.addDefaultTasks(tekEventInstance) // this what i added
        request.withFormat
        {
            form multipartForm
            {
                flash.message = message(code: 'default.created.message', args: [message(code: 'tekEvent.label', default: 'TekEvent'), tekEventInstance.id])
                redirect tekEventInstance
            }
            '*' { respond tekEventInstance, [status: CREATED] }
        }
    }
 
    def edit(TekEvent tekEventInstance)
    {
        respond tekEventInstance
    }
 
    @Transactional
    def update(TekEvent tekEventInstance)
    {
        if (tekEventInstance == null)
        {
            notFound()
            return
        }
 
        if (tekEventInstance.hasErrors())
        {
            respond tekEventInstance.errors, view:'edit'
            return
        }
 
        tekEventInstance.save flush:true
 
        request.withFormat
        {
            form multipartForm
            {
                flash.message = message(code: 'default.updated.message', args: [message(code: 'TekEvent.label', default: 'TekEvent'), tekEventInstance.id])
                redirect tekEventInstance
            }
            '*'
            {
                respond tekEventInstance, [status: OK]
            }
        }
    }
 
    @Transactional
    def delete(TekEvent tekEventInstance)
    {
 
        if (tekEventInstance == null)
        {
            notFound()
            return
        }
 
        tekEventInstance.delete flush:true
 
        request.withFormat
        {
            form multipartForm
            {
                flash.message = message(code: 'default.deleted.message', args: [message(code: 'TekEvent.label', default: 'TekEvent'), tekEventInstance.id])
                redirect action:"index", method:"GET"
            }
            '*'
            {
                render status: NO_CONTENT
            }
        }
    }
 
    protected void notFound()
    {
        request.withFormat
        {
            form multipartForm
            {
                flash.message = message(code: 'default.not.found.message', args: [message(code: 'tekEvent.label', default: 'TekEvent'), params.id])
                redirect action: "index", method: "GET"
            }
            '*'
            {
                render status: NOT_FOUND
            }
        }
    }
}


--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/3c531b41-2f2f-48bc-a794-44b6f872a758%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Thanks Sherif
Reply | Threaded
Open this post in threaded view
|

Re: error appears when i add anything in my controller

sbglasius
Try and move the block to the same line as withFormat:

 request.withFormat {
            form multipartForm
            {
                flash.message = message(code: 'default.created.message', args: [message(code: 'tekEvent.label', default: 'TekEvent'), tekEventInstance.id])
                redirect tekEventInstance
            }
            '*' { respond tekEventInstance, [status: CREATED] }
        }

I think this will help.


Best regards / Med venlig hilsen,
Søren Berg Glasius

Hedevej 1, Gl. Rye, 8680 Ry, Denmark
Mobile: +45 40 44 91 88, Skype: sbglasius
--- Press ESC once to quit - twice to save the changes.

On 28 September 2015 at 15:13, Sherif Shehab <[hidden email]> wrote:

Hi all , 

i'm using Grails 2.5.1 on Windows 7 64 bit , After generating the controllers and the views using Grails command

generate-all "*"

When i add any new lines in my controllers i get the below error : 


Compilation error: startup failed:



E:\Development\eclipse\TekDays\grails-app\controllers\com\tekdays\TekEventController.groovy:
47: Ambiguous expression could be a parameterless closure expression, an
isolated open code block
, or it may continue
a previous
statement
;



   solution:
Add an explicit parameter list, e.g. {it -> ...}, or force it to be treated
as an open block by giving it a label, e.g. L:{...}, and also either remove the
previous newline
, or add an explicit semicolon ';'
@ line 47,
column
4.


           {



      ^

1
error


here is my controller : 



package com.tekdays
 
import static org.springframework.http.HttpStatus.*
 
@Transactional(readOnly = true)
class TekEventController
{
    def taskService // this what i added
    static allowedMethods = [save: "POST", update: "PUT", delete: "DELETE"]
 
    def index(Integer max)
    {
        params.max = Math.min(max ?: 10, 100)
        respond TekEvent.list(params), model:[tekEventInstanceCount: TekEvent.count()]
    }
 
    def show(TekEvent tekEventInstance)
    {
        respond tekEventInstance
    }
 
    def create()
    {
        respond new TekEvent(params)
    }
 
    @Transactional
    def save(TekEvent tekEventInstance)
    {
        if (tekEventInstance == null)
        {
            notFound()
            return
        }
 
        if (tekEventInstance.hasErrors())
        {
            respond tekEventInstance.errors, view:'create'
            return
        }
 
        tekEventInstance.save flush:true
        taskService.addDefaultTasks(tekEventInstance) // this what i added
        request.withFormat
        {
            form multipartForm
            {
                flash.message = message(code: 'default.created.message', args: [message(code: 'tekEvent.label', default: 'TekEvent'), tekEventInstance.id])
                redirect tekEventInstance
            }
            '*' { respond tekEventInstance, [status: CREATED] }
        }
    }
 
    def edit(TekEvent tekEventInstance)
    {
        respond tekEventInstance
    }
 
    @Transactional
    def update(TekEvent tekEventInstance)
    {
        if (tekEventInstance == null)
        {
            notFound()
            return
        }
 
        if (tekEventInstance.hasErrors())
        {
            respond tekEventInstance.errors, view:'edit'
            return
        }
 
        tekEventInstance.save flush:true
 
        request.withFormat
        {
            form multipartForm
            {
                flash.message = message(code: 'default.updated.message', args: [message(code: 'TekEvent.label', default: 'TekEvent'), tekEventInstance.id])
                redirect tekEventInstance
            }
            '*'
            {
                respond tekEventInstance, [status: OK]
            }
        }
    }
 
    @Transactional
    def delete(TekEvent tekEventInstance)
    {
 
        if (tekEventInstance == null)
        {
            notFound()
            return
        }
 
        tekEventInstance.delete flush:true
 
        request.withFormat
        {
            form multipartForm
            {
                flash.message = message(code: 'default.deleted.message', args: [message(code: 'TekEvent.label', default: 'TekEvent'), tekEventInstance.id])
                redirect action:"index", method:"GET"
            }
            '*'
            {
                render status: NO_CONTENT
            }
        }
    }
 
    protected void notFound()
    {
        request.withFormat
        {
            form multipartForm
            {
                flash.message = message(code: 'default.not.found.message', args: [message(code: 'tekEvent.label', default: 'TekEvent'), params.id])
                redirect action: "index", method: "GET"
            }
            '*'
            {
                render status: NOT_FOUND
            }
        }
    }
}


--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/3c531b41-2f2f-48bc-a794-44b6f872a758%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/CAGY%2BWWSNNAFNgqaaP%2Bgqw%3Dv4_4Wd9iubwTD2_WgWoJNk5hA0LQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: error appears when i add anything in my controller

sshehab
Hi , 
i tried , but unfortunately i'm still having the error

Thanks
Sherif

On Monday, September 28, 2015 at 4:27:54 PM UTC+2, Søren Berg Glasius wrote:
Try and move the block to the same line as withFormat:

 request.withFormat {
            form multipartForm
            {
                flash.message = message(code: 'default.created.message', args: [message(code: 'tekEvent.label', default: 'TekEvent'), tekEventInstance.id])
                redirect tekEventInstance
            }
            '*' { respond tekEventInstance, [status: CREATED] }
        }

I think this will help.


Best regards / Med venlig hilsen,
Søren Berg Glasius

Hedevej 1, Gl. Rye, 8680 Ry, Denmark
Mobile: +45 40 44 91 88, Skype: sbglasius
--- Press ESC once to quit - twice to save the changes.

On 28 September 2015 at 15:13, Sherif Shehab <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="yIzhwTkYBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">sherif...@...> wrote:

Hi all , 

i'm using Grails 2.5.1 on Windows 7 64 bit , After generating the controllers and the views using Grails command

generate-all "*"

When i add any new lines in my controllers i get the below error : 


Compilation error: startup failed:



E:\Development\eclipse\TekDays\grails-app\controllers\com\tekdays\TekEventController.groovy:
47: Ambiguous expression could be a parameterless closure expression, an
isolated open code block
, or it may continue
a previous
statement
;



   solution:
Add an explicit parameter list, e.g. {it -> ...}, or force it to be treated
as an open block by giving it a label, e.g. L:{...}, and also either remove the
previous newline
, or add an explicit semicolon ';'
@ line 47,
column
4.


           {



      ^

1
error


here is my controller : 



package com.tekdays
 
import static org.springframework.http.HttpStatus.*
 
@Transactional(readOnly = true)
class TekEventController
{
    def taskService // this what i added
    static allowedMethods = [save: "POST", update: "PUT", delete: "DELETE"]
 
    def index(Integer max)
    {
        params.max = Math.min(max ?: 10, 100)
        respond TekEvent.list(params), model:[tekEventInstanceCount: TekEvent.count()]
    }
 
    def show(TekEvent tekEventInstance)
    {
        respond tekEventInstance
    }
 
    def create()
    {
        respond new TekEvent(params)
    }
 
    @Transactional
    def save(TekEvent tekEventInstance)
    {
        if (tekEventInstance == null)
        {
            notFound()
            return
        }
 
        if (tekEventInstance.hasErrors())
        {
            respond tekEventInstance.errors, view:'create'
            return
        }
 
        tekEventInstance.save flush:true
        taskService.addDefaultTasks(tekEventInstance) // this what i added
        request.withFormat
        {
            form multipartForm
            {
                flash.message = message(code: 'default.created.message', args: [message(code: 'tekEvent.label', default: 'TekEvent'), tekEventInstance.id])
                redirect tekEventInstance
            }
            '*' { respond tekEventInstance, [status: CREATED] }
        }
    }
 
    def edit(TekEvent tekEventInstance)
    {
        respond tekEventInstance
    }
 
    @Transactional
    def update(TekEvent tekEventInstance)
    {
        if (tekEventInstance == null)
        {
            notFound()
            return
        }
 
        if (tekEventInstance.hasErrors())
        {
            respond tekEventInstance.errors, view:'edit'
            return
        }
 
        tekEventInstance.save flush:true
 
        request.withFormat
        {
            form multipartForm
            {
                flash.message = message(code: 'default.updated.message', args: [message(code: 'TekEvent.label', default: 'TekEvent'), tekEventInstance.id])
                redirect tekEventInstance
            }
            '*'
            {
                respond tekEventInstance, [status: OK]
            }
        }
    }
 
    @Transactional
    def delete(TekEvent tekEventInstance)
    {
 
        if (tekEventInstance == null)
        {
            notFound()
            return
        }
 
        tekEventInstance.delete flush:true
 
        request.withFormat
        {
            form multipartForm
            {
                flash.message = message(code: 'default.deleted.message', args: [message(code: 'TekEvent.label', default: 'TekEvent'), tekEventInstance.id])
                redirect action:"index", method:"GET"
            }
            '*'
            {
                render status: NO_CONTENT
            }
        }
    }
 
    protected void notFound()
    {
        request.withFormat
        {
            form multipartForm
            {
                flash.message = message(code: 'default.not.found.message', args: [message(code: 'tekEvent.label', default: 'TekEvent'), <a href="http://params.id" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fparams.id\46sa\75D\46sntz\0751\46usg\75AFQjCNE9pYT7y6HQ_CPjFF-biETLNyAswg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fparams.id\46sa\75D\46sntz\0751\46usg\75AFQjCNE9pYT7y6HQ_CPjFF-biETLNyAswg&#39;;return true;">params.id])
                redirect action: "index", method: "GET"
            }
            '*'
            {
                render status: NOT_FOUND
            }
        }
    }
}


--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="yIzhwTkYBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">grails-dev-discuss+unsubscribe@....
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="yIzhwTkYBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">grails-de...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/grails-dev-discuss/3c531b41-2f2f-48bc-a794-44b6f872a758%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/grails-dev-discuss/3c531b41-2f2f-48bc-a794-44b6f872a758%40googlegroups.com?utm_medium\75email\46utm_source\75footer&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/grails-dev-discuss/3c531b41-2f2f-48bc-a794-44b6f872a758%40googlegroups.com?utm_medium\75email\46utm_source\75footer&#39;;return true;">https://groups.google.com/d/msgid/grails-dev-discuss/3c531b41-2f2f-48bc-a794-44b6f872a758%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/e148fbc2-757b-4b49-a4b7-402fe2212ee0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Thanks Sherif
Reply | Threaded
Open this post in threaded view
|

Re: error appears when i add anything in my controller

Christian Knoblauch
The error message says there's an error on line 47. In the controller you included, that's the brace after form.multipartform:

form multipartForm
{    // <-- line 47

Try putting that brace right after form.multipartForm instead of in a line of its own, see if that works.

    Christian

On Mon, Sep 28, 2015 at 11:46 AM, Sherif Shehab <[hidden email]> wrote:
Hi , 
i tried , but unfortunately i'm still having the error

Thanks
Sherif

On Monday, September 28, 2015 at 4:27:54 PM UTC+2, Søren Berg Glasius wrote:
Try and move the block to the same line as withFormat:

 request.withFormat {
            form multipartForm
            {
                flash.message = message(code: 'default.created.message', args: [message(code: 'tekEvent.label', default: 'TekEvent'), tekEventInstance.id])
                redirect tekEventInstance
            }
            '*' { respond tekEventInstance, [status: CREATED] }
        }

I think this will help.


Best regards / Med venlig hilsen,
Søren Berg Glasius

Hedevej 1, Gl. Rye, 8680 Ry, Denmark
Mobile: <a href="tel:%2B45%2040%2044%2091%2088" value="+4540449188" target="_blank">+45 40 44 91 88, Skype: sbglasius
--- Press ESC once to quit - twice to save the changes.

On 28 September 2015 at 15:13, Sherif Shehab <[hidden email]> wrote:

Hi all , 

i'm using Grails 2.5.1 on Windows 7 64 bit , After generating the controllers and the views using Grails command

generate-all "*"

When i add any new lines in my controllers i get the below error : 


Compilation error: startup failed:



E:\Development\eclipse\TekDays\grails-app\controllers\com\tekdays\TekEventController.groovy:
47: Ambiguous expression could be a parameterless closure expression, an
isolated open code block
, or it may continue
a previous
statement
;



   solution:
Add an explicit parameter list, e.g. {it -> ...}, or force it to be treated
as an open block by giving it a label, e.g. L:{...}, and also either remove the
previous newline
, or add an explicit semicolon ';'
@ line 47,
column
4.


           {



      ^

1
error


here is my controller : 



package com.tekdays
 
import static org.springframework.http.HttpStatus.*
 
@Transactional(readOnly = true)
class TekEventController
{
    def taskService // this what i added
    static allowedMethods = [save: "POST", update: "PUT", delete: "DELETE"]
 
    def index(Integer max)
    {
        params.max = Math.min(max ?: 10, 100)
        respond TekEvent.list(params), model:[tekEventInstanceCount: TekEvent.count()]
    }
 
    def show(TekEvent tekEventInstance)
    {
        respond tekEventInstance
    }
 
    def create()
    {
        respond new TekEvent(params)
    }
 
    @Transactional
    def save(TekEvent tekEventInstance)
    {
        if (tekEventInstance == null)
        {
            notFound()
            return
        }
 
        if (tekEventInstance.hasErrors())
        {
            respond tekEventInstance.errors, view:'create'
            return
        }
 
        tekEventInstance.save flush:true
        taskService.addDefaultTasks(tekEventInstance) // this what i added
        request.withFormat
        {
            form multipartForm
            {
                flash.message = message(code: 'default.created.message', args: [message(code: 'tekEvent.label', default: 'TekEvent'), tekEventInstance.id])
                redirect tekEventInstance
            }
            '*' { respond tekEventInstance, [status: CREATED] }
        }
    }
 
    def edit(TekEvent tekEventInstance)
    {
        respond tekEventInstance
    }
 
    @Transactional
    def update(TekEvent tekEventInstance)
    {
        if (tekEventInstance == null)
        {
            notFound()
            return
        }
 
        if (tekEventInstance.hasErrors())
        {
            respond tekEventInstance.errors, view:'edit'
            return
        }
 
        tekEventInstance.save flush:true
 
        request.withFormat
        {
            form multipartForm
            {
                flash.message = message(code: 'default.updated.message', args: [message(code: 'TekEvent.label', default: 'TekEvent'), tekEventInstance.id])
                redirect tekEventInstance
            }
            '*'
            {
                respond tekEventInstance, [status: OK]
            }
        }
    }
 
    @Transactional
    def delete(TekEvent tekEventInstance)
    {
 
        if (tekEventInstance == null)
        {
            notFound()
            return
        }
 
        tekEventInstance.delete flush:true
 
        request.withFormat
        {
            form multipartForm
            {
                flash.message = message(code: 'default.deleted.message', args: [message(code: 'TekEvent.label', default: 'TekEvent'), tekEventInstance.id])
                redirect action:"index", method:"GET"
            }
            '*'
            {
                render status: NO_CONTENT
            }
        }
    }
 
    protected void notFound()
    {
        request.withFormat
        {
            form multipartForm
            {
                flash.message = message(code: 'default.not.found.message', args: [message(code: 'tekEvent.label', default: 'TekEvent'), params.id])
                redirect action: "index", method: "GET"
            }
            '*'
            {
                render status: NOT_FOUND
            }
        }
    }
}


--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/3c531b41-2f2f-48bc-a794-44b6f872a758%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/e148fbc2-757b-4b49-a4b7-402fe2212ee0%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/CAHnbsiN8T7RMZqXua6v_WyLs0Ff8Di1K2gpiinzaZO18yec9GQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: error appears when i add anything in my controller

sshehab
Hi , Wow it fixed the issue , it never crossed my mind that this may be the problem , does it make any difference in the syntax , in my thought both are same !!!

Thanks

On Tuesday, September 29, 2015 at 3:26:17 PM UTC+2, Christian Knoblauch wrote:
The error message says there's an error on line 47. In the controller you included, that's the brace after form.multipartform:

form multipartForm
{    // <-- line 47

Try putting that brace right after form.multipartForm instead of in a line of its own, see if that works.

    Christian

On Mon, Sep 28, 2015 at 11:46 AM, Sherif Shehab <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="qVp4gnFjBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">sherif...@...> wrote:
Hi , 
i tried , but unfortunately i'm still having the error

Thanks
Sherif

On Monday, September 28, 2015 at 4:27:54 PM UTC+2, Søren Berg Glasius wrote:
Try and move the block to the same line as withFormat:

 request.withFormat {
            form multipartForm
            {
                flash.message = message(code: 'default.created.message', args: [message(code: 'tekEvent.label', default: 'TekEvent'), tekEventInstance.id])
                redirect tekEventInstance
            }
            '*' { respond tekEventInstance, [status: CREATED] }
        }

I think this will help.


Best regards / Med venlig hilsen,
Søren Berg Glasius

Hedevej 1, Gl. Rye, 8680 Ry, Denmark
Mobile: +45 40 44 91 88, Skype: sbglasius
--- Press ESC once to quit - twice to save the changes.

On 28 September 2015 at 15:13, Sherif Shehab <[hidden email]> wrote:

Hi all , 

i'm using Grails 2.5.1 on Windows 7 64 bit , After generating the controllers and the views using Grails command

generate-all "*"

When i add any new lines in my controllers i get the below error : 


Compilation error: startup failed:



E:\Development\eclipse\TekDays\grails-app\controllers\com\tekdays\TekEventController.groovy:
47: Ambiguous expression could be a parameterless closure expression, an
isolated open code block
, or it may continue
a previous
statement
;



   solution:
Add an explicit parameter list, e.g. {it -> ...}, or force it to be treated
as an open block by giving it a label, e.g. L:{...}, and also either remove the
previous newline
, or add an explicit semicolon ';'
@ line 47,
column
4.


           {



      ^

1
error


here is my controller : 



package com.tekdays
 
import static org.springframework.http.HttpStatus.*
 
@Transactional(readOnly = true)
class TekEventController
{
    def taskService // this what i added
    static allowedMethods = [save: "POST", update: "PUT", delete: "DELETE"]
 
    def index(Integer max)
    {
        params.max = Math.min(max ?: 10, 100)
        respond TekEvent.list(params), model:[tekEventInstanceCount: TekEvent.count()]
    }
 
    def show(TekEvent tekEventInstance)
    {
        respond tekEventInstance
    }
 
    def create()
    {
        respond new TekEvent(params)
    }
 
    @Transactional
    def save(TekEvent tekEventInstance)
    {
        if (tekEventInstance == null)
        {
            notFound()
            return
        }
 
        if (tekEventInstance.hasErrors())
        {
            respond tekEventInstance.errors, view:'create'
            return
        }
 
        tekEventInstance.save flush:true
        taskService.addDefaultTasks(tekEventInstance) // this what i added
        request.withFormat
        {
            form multipartForm
            {
                flash.message = message(code: 'default.created.message', args: [message(code: 'tekEvent.label', default: 'TekEvent'), tekEventInstance.id])
                redirect tekEventInstance
            }
            '*' { respond tekEventInstance, [status: CREATED] }
        }
    }
 
    def edit(TekEvent tekEventInstance)
    {
        respond tekEventInstance
    }
 
    @Transactional
    def update(TekEvent tekEventInstance)
    {
        if (tekEventInstance == null)
        {
            notFound()
            return
        }
 
        if (tekEventInstance.hasErrors())
        {
            respond tekEventInstance.errors, view:'edit'
            return
        }
 
        tekEventInstance.save flush:true
 
        request.withFormat
        {
            form multipartForm
            {
                flash.message = message(code: 'default.updated.message', args: [message(code: 'TekEvent.label', default: 'TekEvent'), tekEventInstance.id])
                redirect tekEventInstance
            }
            '*'
            {
                respond tekEventInstance, [status: OK]
            }
        }
    }
 
    @Transactional
    def delete(TekEvent tekEventInstance)
    {
 
        if (tekEventInstance == null)
        {
            notFound()
            return
        }
 
        tekEventInstance.delete flush:true
 
        request.withFormat
        {
            form multipartForm
            {
                flash.message = message(code: 'default.deleted.message', args: [message(code: 'TekEvent.label', default: 'TekEvent'), tekEventInstance.id])
                redirect action:"index", method:"GET"
            }
            '*'
            {
                render status: NO_CONTENT
            }
        }
    }
 
    protected void notFound()
    {
        request.withFormat
        {
            form multipartForm
            {
                flash.message = message(code: 'default.not.found.message', args: [message(code: 'tekEvent.label', default: 'TekEvent'), <a href="http://params.id" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fparams.id\46sa\75D\46sntz\0751\46usg\75AFQjCNE9pYT7y6HQ_CPjFF-biETLNyAswg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fparams.id\46sa\75D\46sntz\0751\46usg\75AFQjCNE9pYT7y6HQ_CPjFF-biETLNyAswg&#39;;return true;">params.id])
                redirect action: "index", method: "GET"
            }
            '*'
            {
                render status: NOT_FOUND
            }
        }
    }
}


--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grails-dev-discuss+[hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/grails-dev-discuss/3c531b41-2f2f-48bc-a794-44b6f872a758%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/grails-dev-discuss/3c531b41-2f2f-48bc-a794-44b6f872a758%40googlegroups.com?utm_medium\75email\46utm_source\75footer&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/grails-dev-discuss/3c531b41-2f2f-48bc-a794-44b6f872a758%40googlegroups.com?utm_medium\75email\46utm_source\75footer&#39;;return true;">https://groups.google.com/d/msgid/grails-dev-discuss/3c531b41-2f2f-48bc-a794-44b6f872a758%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="qVp4gnFjBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">grails-dev-discuss+unsubscribe@....
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="qVp4gnFjBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">grails-de...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/grails-dev-discuss/e148fbc2-757b-4b49-a4b7-402fe2212ee0%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/grails-dev-discuss/e148fbc2-757b-4b49-a4b7-402fe2212ee0%40googlegroups.com?utm_medium\75email\46utm_source\75footer&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/grails-dev-discuss/e148fbc2-757b-4b49-a4b7-402fe2212ee0%40googlegroups.com?utm_medium\75email\46utm_source\75footer&#39;;return true;">https://groups.google.com/d/msgid/grails-dev-discuss/e148fbc2-757b-4b49-a4b7-402fe2212ee0%40googlegroups.com.

For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/a3541238-445c-43b1-87d0-a7db50c54b5d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Thanks Sherif