Question -
I noticed that some of the applications I'm testing with have calls to a different view / controller from the submit file, but when this page is displayed, instead of seeing:
$ controller / $ page
I see:
$ Controller / index
Is this a problem with the URL mapping configuration? Default action? Just curious, because it looks like matching a default URI instead of the actual action.
view code:
<table> .. <g:actionSubmit class="stats" action="stats" value="View Stats"/> .. </table
controller:
def stats() { def teamId = Team.get(params.id) def allPlayers = Player.withCriteria { eq('team', teamId) and { eq('isActive', true) } } [allPlayers:allPlayers, teamId:params.id] }
UrlMapping:
class UrlMappings { static mappings = { "/$controller/$action?/$id?"{ constraints {
Edit
I really understood what it is. This bothers me even more.
The grailsSubmit action has an action associated with it. This form was just a normal form, without calling:
<g:form> <g:actionSubmit class="stats" action="stats" value="View Stats"/> <g:actionSubmit class="schedule" action="schedule" value="View Schedule"/> <g:form>
Thus, by default, the form redirects the action to $ controller / index. If you add an action call to the g: form tag, these two buttons will go to the correct page, but the URI will now be $ controller / $ g: form_action.
I think that I do not get the actionSubmit action point if the g: form is required as a wrapper.
source share