remove application name from URL

那年仲夏 提交于 2019-11-30 16:04:33

how can i remove the application name wompower6 , so that the url becomes mysitename.com/home?

This is a webapp <Context> setting and configuration is dependent on the servletcontainer used. If you're for example using Tomcat, then there are basically 2 options to make your webapp the root webapp.

  1. Rename the WAR file to ROOT.war and Tomcat will by default deploy it on context root.

  2. Set path attribute of <Context> element in Webapp/META-INF/context.xml (or Tomcat/conf/server.xml, depending where you'd like to define it) to an empty String. E.g.

    <Context path="" ...>
    

Other containers support similar constructs. Consult their documentation for detail. If you're using an IDE like Eclipse, then you can also set it in the Web Project Settings property of the project properties (rightclick project and choose Properties). Set the Context root value to just /.


in my web.xml, i have home.xhtml, but this does not seem to work. When i type, mysitename.com, it does not get mapped to home.xhtml. any clue here?

I assume that you're talking about the <welcome-file> setting. This has to point to a physically existing file, not to a virtual URL, such as /faces/*. There are basically two ways to overcome this:

  1. Provide a physically existing /faces/home.xhtml file (it can even be left empty).

  2. Replace the ugly /faces/* URL pattern of the FacesServlet mapping in web.xml by *.xhtml so that it will just kick in on every request for a XHTML file.

    <url-pattern>*.xhtml</url-pattern>
    

    This way you don't need to fiddle with /faces/* URL patterns.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!