2

I have a Grails 2.3.11 application which has a static html page to load JS web ui developed in ExtJS.

I wanted to load the static index page by default by using redirect in UrlMapping.groovy like this:

"/"(redirect: '/static/app/index.html')

This particular redirect does not work. Completely empty page is opened instead.

A few other redirects work properly.

Shall in general be possible to have a redirect for "/"?

matejk
  • 798
  • 1
  • 14
  • 27

2 Answers2

1

@matejk Where is your index.html page resides? Are you using resource plugin? You redirect may not be working due to the invalid location of index.html or resource plugin accessibility.

Although you can directly render its content without changing the url.

"/"(uri: '/static/app/index.html')

This will render the content directly instead of a redirect. but this again depends on your location of index.html.

Shashank Agrawal
  • 25,161
  • 11
  • 89
  • 121
  • Resource plugin is not used. index.html is static file located in web-app/static/app/index.html. I'll try to use uri instead of redirect. – matejk Dec 23 '14 at 13:51
  • Okay, well redirect should work as I'm using the same. You said an empty page is being loaded that means there is some error on html page itself otherwise you should get 404 page. – Shashank Agrawal Dec 23 '14 at 14:07
0

you can rename your index.html to index.gsp and have following in UrlMappings

"/"(view: '/static/app/index.gsp')
Aram Arabyan
  • 2,339
  • 1
  • 17
  • 30
  • Thanks for the tip. I thought that gsp files have to reside in grails-app/views/. Do you know why redirect does not work? – matejk Oct 16 '14 at 10:45