I have a scenario where i am calling a Controller method from the view,that returns an array of pages,which can be either nil or must be having values.i need to iterate that array in a for loop to generate a dynamic list in my view.pls help
Share
Implementing logic in your controllers is generally not a good idea you should move logic into the corresponding model.
But if you really want to you can use
controllervariable to reach the actual controller from your view.Example:
Iterating through the returned value is easy:
Probably the visibility of the method in your controller is not public, so you may need to use the
Object#sendmethod.Update
To handle the
nilreponse, I would create a helper method in theApplicationHelperclass:And then in the view: