A controller qustion

View: New views
5 Messages — Rating Filter:   Alert me  

A controller qustion

by Fox Woo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
   I define tow methods in my controller:
      def revise = {
            def item
             // blah blah
}
   def check = {
            def item
             // blah blah
}
When I compile the code I got the exception: The current
scope already contains a variable of the name item.
Dose it mean I can not define a local variable which is accessible within the method

--
爱生活,爱FOX

Re: A controller qustion

by Sonny To :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

this should be fine... u are probably defining item in the outter scope

On Fri, May 16, 2008 at 10:37 AM, Fox Woo <foxwu718@...> wrote:

> Hi,
>    I define tow methods in my controller:
>       def revise = {
>             def item
>              // blah blah
> }
>    def check = {
>             def item
>              // blah blah
> }
> When I compile the code I got the exception: The current
> scope already contains a variable of the name item.
> Dose it mean I can not define a local variable which is accessible within
> the method
>
> --
> 爱生活,爱FOX

Re: A controller qustion

by Peter Ledbrook-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2008/5/16 Fox Woo <foxwu718@...>:

> Hi,
>    I define tow methods in my controller:
>       def revise = {
>             def item
>              // blah blah
> }
>    def check = {
>             def item
>              // blah blah
> }

Make sure your curly braces are all fine. The error probably means
that one of your actions defines "item" twice, or the "check" action
is inside the "revise" action (due to curly brace mismatch).

Cheers,

Peter

--
Software Engineer
G2One, Inc.
http://www.g2one.com/

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: A controller qustion

by Fox Woo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I upgrade to 1.0.3-SNAPSHOT and the error occured. After clean it is ok.

2008/5/16 Peter Ledbrook <peter@...>:
2008/5/16 Fox Woo <foxwu718@...>:
> Hi,
>    I define tow methods in my controller:
>       def revise = {
>             def item
>              // blah blah
> }
>    def check = {
>             def item
>              // blah blah
> }

Make sure your curly braces are all fine. The error probably means
that one of your actions defines "item" twice, or the "check" action
is inside the "revise" action (due to curly brace mismatch).

Cheers,

Peter

--
Software Engineer
G2One, Inc.
http://www.g2one.com/

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email





--
爱生活,爱FOX

Re: A controller qustion

by Daniel Honig :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

grails clean is your friend.  Generally speaking you should always do
a clean before/after an upgrade.

On Fri, May 16, 2008 at 3:19 AM, Fox Woo <foxwu718@...> wrote:

> I upgrade to 1.0.3-SNAPSHOT and the error occured. After clean it is ok.
>
> 2008/5/16 Peter Ledbrook <peter@...>:
>>
>> 2008/5/16 Fox Woo <foxwu718@...>:
>> > Hi,
>> >    I define tow methods in my controller:
>> >       def revise = {
>> >             def item
>> >              // blah blah
>> > }
>> >    def check = {
>> >             def item
>> >              // blah blah
>> > }
>>
>> Make sure your curly braces are all fine. The error probably means
>> that one of your actions defines "item" twice, or the "check" action
>> is inside the "revise" action (due to curly brace mismatch).
>>
>> Cheers,
>>
>> Peter
>>
>> --
>> Software Engineer
>> G2One, Inc.
>> http://www.g2one.com/
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>
>
>
> --
> 爱生活,爱FOX