0
votes

I cloned polymer starter kit 1.0 and its working perfectly fine only if the url is : localhost:8080. When I tried with Eclipse and Apache Tomcat 8.0 to build a Java MVC application then URL would be as : localhost:8080/project-name.

Now the behaviour of the page navigation changed dramatically. When I start the project the URL comes as: localhost:8080/project-name/#!/project-name

But it should come like: localhost:8080/project-name and should show home page and on clicking on users or contact tab the url should be :

  • localhost:8080/project-name/#!/users
  • localhost:8080/project-name/#!/contact but it is showing like:
  • localhost:8080/project-name/#!/project-name/users
  • localhost:8080/project-name/#!/project-name/contact

I tried to make app.baseUrl =" ";. Changed the routing.html routing for home to empty or '*'but nothing worked. Any help would be highly appreciated.

Thanks.

1

1 Answers

0
votes

You must deploy your app as "ROOT.war" to hide the projects context. The name of your project is deployed as the "context" in the URL.

Naming your app ROOT simply tells Tomcat it is the main app to run and you will indeed get below as your projects context.

localhost:8080

Don't worry about the Tomcat homepage, I simply rename it to "ROOT-1" when I really want to keep it. Also don't worry about the context while running in eclipse because it would awkward to test your app as ROOT. Just rename the .war to ROOT before launch.

When you see the "#" it usually means your are navigating to some point in an html file, i.e. looks like your app is SPA.

"#!/appComponent"

The line below simply looks like you have a SPA style page with the same name as your project with all the other pages inside of it.

localhost:8080/project-name/#!/project-name/users