Below is a very simple controller with a "search" action that is fired from g:submitButton in a gsp file. My question is, instead of redirecting to the "index" action and view, how do I return to the view that contained the submit button that called this controller's search action?
class DefaultSearchController {
def searchableService
def index = {
}
def search = {
def query = params.query
if(!query){
redirect(action:"index", params:params)
}
try{
def searchResults = searchableService.searchEvery( query )
redirect(action:"index", searchResults)
}
catch( e ){
params.errors = "${e.toString()}"
redirect(action: "index", params:params)
}
}
}