Angular6 builds and deploys to the back-end java project

< H2 > angular6 builds and deploys to backend java projects < / H2 >
  • be sure to try to deploy once before completing the entire front-end project, in case of future trouble.
  • first introduce my development environment:
    angular6, ant design UI Suite, PrimeNG UI Suite, vs code
    java8, tomcat9, SSM+MybatisGenerator, Eclipse
  • my steps to deploy the front-end project:

    1. use the angular command ng build to build the angular project, and get the dist folder
      there is a difference here. There are a lot of materials found on the Internet to describe the construction and deployment of angular2.
      build using ng build in version 2 will generate folder dist
      compiled files under the project root directory directly under the dist folder, while I use version 6 to build: dist/source
      compiled files are placed under source.
    2. create a folder dist, under webapp/WEB-NF in Eclipse and copy all the files under the source
      directory in step 1 above to webapp/WEB-INF/dist.
    3. modify the < base > tag in index.html under dist in step 2 above. After modification:
      < base href= "/ angularF/dist/" >
    4. the port number of my tomcat is 8080 (other projects passed the test). So the URL I visit the home page of the project is
      http://localhost:8080/angularF/dist/index.html
      , but the browser appears 404, and then try to copy the webapp/WEB-INF/dist folder to webapp
      still use the access path: http://localhost:8080/angularF/dist/index.html
      still prompts 404
  • my question: am I copying the wrong path? Or is it that my access path is incorrect and causes 404?

           thanks for any help!
  • if necessary: I am glad to make like-minded friends, my QRV 409223171
Dec.27,2021

WEB-NF should follow the directory. Where did your angularF come from


have you solved your problem?


server rendering reference: ide/universal" rel=" nofollow noreferrer "> https://angular.cn/guide/univ.

Menu