History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: GRAILS-3153
Type: Bug Bug
Status: Open Open
Priority: Critical Critical
Assignee: Graeme Rocher
Reporter: Dmitriy Kopylenko
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Grails

g:link tag does not produce correct links based on UrlMappings if UrlMappings does not explicitly specify 'action' (for default action)

Created: 22/Jun/08 10:03 AM   Updated: 22/Jul/08 08:58 AM
Component/s: TagLib
Affects Version/s: 1.0.3
Fix Version/s: 1.0.4

Time Tracking:
Not Specified

File Attachments: 1. GZip Archive default-action.tar.gz (143 kb)

Environment: Linux (2.6.13-15.18-smp), Java (Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing))

Testcase included: yes


 Description  « Hide
This is clearly broken in 1.0.3.

Here's the deal. If the UrlMapping contains a mapping without an action defined, relying on the 'default action' mechanism, the g:link tag gets "confused" and produses wrong link in the form of /app/{controller}/{default-action} instead of just /app/{whatever-the-custom-mapping}

Here's the example from the attached sample app:

Controller:

class DefaultActionBugReportController {

    def index = { 
    	render "Hello. I'm your deafult action"
    }
}

UrlMapping:

class UrlMappings {
    static mappings = {
	"/"(view:'/home')
      	"/shouldRouteToDefaultAction"(controller: 'defaultActionBugReport')
    }
}

and home.gsp:

<html>
  <head>
	  
  </head>
  
  <body>
    <g:link controller="defaultActionBugReport">Default action</g:link>    
  </body>
</html>

fails with wrong link produced.

When explicitly adding action:'index' to the UrlMapping it works (could use it as work around for now, but really would love to go back to the 'default action')

Note: sample app is attached.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Graeme Rocher - 21/Jul/08 10:03 AM
This issue is in conflict with this issue http://jira.codehaus.org/browse/GRAILS-2722

If I fix this one then the other regresses


Dmitriy Kopylenko - 21/Jul/08 01:56 PM
So what's the solution? I mean I could live with having to specify the default action explicitly in UrlMappings, but is this the best thing in general?

Graeme Rocher - 22/Jul/08 08:58 AM
Yes that is the best thing to do