Search code examples
grailsgrails-2.0gsp

Grails 2.5 : Resource not found (404) for GSP file


I am upgrading my Grails application from version 1.x to 2.5 and facing this issue in version 2.5 which worked fine in version 1.x

In GSP file (connect.gsp) I am trying to open another gsp rename.gsp. This rename.gsp file is in the same location as that of connect.gsp. However, the file is not found and 404-Resource not found error is shown in the pop-up.

connect.gsp (javascript code)

showPopWin("${request.getContextPath()}/user/rename.gsp", 280, 160, returnFunction);

Location of gsp files:

grails-app
     - views
          -user
              -connect.gsp
              -rename.gsp

Is anything related to GSP file loading changed in Grails 2.x version ? Please help !


Solution

  • Looks like resources rendering is changed in Grails 2.x

    I have added below workaround:

    In places where I have to call a gsp page (not controller action) from another gsp, then submit it first to controller action and from there use render to go to respective gsp file.

    That is, in connect.gsp

    showPopWin("${request.getContextPath()}/user/renameUI", 280, 160, returnFunction);
    

    In UserController add an action renameUI,

    def renameUI= {
        render( view : 'rename', model:[params:params])
    }