When I run a Grails web application in Eclipse, it runs in tomcat at localhost:8080/projectname
Due to this, when my css needs to reference an image it needs to reference /projectname/images/image.gif. On the production server, however, the application will run at the root directory, so projectname can’t be hardcoded into the path.
How can I debug the application in the root directory? Is this even the right way to think about the problem? Thanks.
I think you can reference the
projectnamebyrequest.getContextPath()which should give you always the right application path.