问题
Grails 3.0.0 M1 states that g:remoteLink is deprecated and in 3.0.1 it no longer exists in the g: namespace. There is nothing in the documentation that suggests replacement of this functionality. Will someone please respond with a replacement option for GSP files to execute a controller action using the Prototype JavaScript library? If also possible, would a solution utilizing a Groovy custom tag library to eliminate embedded code directly in GSP files be presented?
回答1:
The tags use inline javascript embedded into HTML tags which has long been considered bad practise. At the same time the APIs for creating remote links with JavaScript frameworks like jQuery and so on have advanced to the point where it is just as easy to use them and they have the advantage that the static resources can be optimised by asset pipeline and your application will perform better.
So given how things have changed over the last few years the Grails team decided to deprecate the tags as they are no longer considered best practise and you are better off using the native JavaScript APIs (jQuery etc.) as an alternative.
The original tags are still available at https://bintray.com/grails/plugins/ajax-tags
If you want them you have to declare a dependency:
compile 'org.grails.plugins:ajax-tags:1.0.0.RC1'
来源:https://stackoverflow.com/questions/30813084/grails-3-0-gremotelink-ajax-call-replacement-due-to-deprecation