Test User
Test User

Reputation: 57

Grails button not executing my action?

I have this button in my view page

<a class="runimg" href="${createLink(controller: 'Ec2Controller', action: 'Start', id: i.Id)}">&nbsp;Start&nbsp;</a>

It is suppose to take the id of the instance and then pass it to my action in the controller. However it is looking for the Start view page rather than executing my action in the Ec2Controller. Any suggestion?

My controller has this

    def Start() {
    amazonWebService.ec2.startInstances(new StartInstancesRequest([InstanceToStart]))
    redirect action: index()
}

Upvotes: 1

Views: 107

Answers (2)

James Kleeh
James Kleeh

Reputation: 12238

In addition to what @Sérgio said, unless your controller is named Ec2ControllerController, your controller name is wrong. It should just be Ec2.

Upvotes: 1

user800014
user800014

Reputation:

You called a method index in your redirect:

redirect action: index()

It should be

redirect action: 'index'

Upvotes: 0

Related Questions