简体   繁体   中英

Index.html as welcome page in spring+angularJS application

Have an application with SpringMVC+AngularJS. Have place the index.html page in src/main/webapp/app/src/index.html.

In web.xml have

<welcome-file-list>  
  <welcome-file>index.html</welcome-file>  
</welcome-file-list> 

The application works with

http://localhost:8080/myapp/app/index.html

But not with http://localhost:8080/myapp What changes should be made so that the application is directed to the index.html page correctly

Try to replace

<welcome-file>index.html</welcome-file>

with

<welcome-file>app/index.html</welcome-file>

I am assuming that you have any InternalResourceViewResolver configured. You have to make 2 changes. 1. Change welcome-file in web.xml like below

<welcome-file-list>
    <welcome-file>app/src/index.html</welcome-file>
</welcome-file-list>`
  1. change dispatcher-servlet.xml or whatever configuration file you have like below <mvc:resources mapping="/app/src/**" location="/app/src/"/> <mvc:default-servlet-handler />

You can google for annotations for above configuration if you are having annotation based configuration.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM