I want to use an HTML page in a grails application. But not able

I am using grails 2.0.1 and I tried linking to the html page using direct url = "somefile.html>, but it does not work. How do I do this? Help help

+5
source share
1 answer

You need to do two things:

  • Make sure the file is stored in web-app/somefile.html, here you store the raw files for the server.
  • Instead of using a hard-coded URL, use a method g.resource()or tag <g:resource>. In these cases, you will use it like this:

    <a href="${g.resource(file:'somefile.html')}">My Link</a>
    

g.resource , . href="somefile.html", . URI myapp/controller/action/foo, myapp/controller/action/somefile.html.

. cached-resources - , , URL- myapp/somefile.html. - , URL.

+7

All Articles