I am using grails 2.0.1 and i tried linking to the html page using with the direct url=”somefile.html> but it is not working out . How do i do it ?please help
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need to do two things:
web-app/somefile.html, this is where you store raw files for the server.Instead of using a hard-coded URL, use the
g.resource()method or the<g:resource>tag. In these cases, you’ll use it like so:The reason to use the
g.resourcetag is it guarantees a correct link to the file. If you just hard code the file likehref="somefile.html", then is is a relative path. If you are at the URImyapp/controller/action/foo, it will look for the file undermyapp/controller/action/somefile.html.Note: If you are using the
cached-resourcesplugin or something similar, you will find the output URL is not actuallymyapp/somefile.html. The file is still accessible from that location, but the generated links will point to a static URL instead.