jsf - remove application name from URL -


my site uses jsf , url appears be, http://mysitename.com/wompower6/faces/home.xhtml

i using prettyfaces, if use following in pretty-config.xml, can change name http://mysitename.com/wompower6/home

<url-mapping id="home">     <pattern value="/home" />     <view-id value="/faces/home.xhtml" /> </url-mapping> 

my questions

  1. how can remove application name wompower6 , url becomes mysitename.com/home ?

  2. in web.xml, have <welcome-file>home.xhtml</welcome-file>, not seem work. when type, mysitename.com, not mapped home.xhtml. clue here?

how can remove application name wompower6 , url becomes mysitename.com/home?

this webapp <context> setting , configuration dependent on servletcontainer used. if you're example using tomcat, there 2 options make webapp root webapp.

  1. rename war file root.war , tomcat default deploy on context root.

  2. set path attribute of <context> element in webapp/meta-inf/context.xml (or tomcat/conf/server.xml, depending you'd define it) empty string. e.g.

    <context path="" ...> 

other containers support similar constructs. consult documentation detail. if you're using ide eclipse, can set in web project settings property of project properties (rightclick project , choose properties). set context root value /.


in web.xml, have home.xhtml, not seem work. when type, mysitename.com, not mapped home.xhtml. clue here?

i assume you're talking <welcome-file> setting. has point physically existing file, not virtual url, such /faces/*. there 2 ways overcome this:

  1. provide physically existing /faces/home.xhtml file (it can left empty).

  2. replace ugly /faces/* url pattern of facesservlet mapping in web.xml *.xhtml kick in on every request xhtml file.

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

    this way don't need fiddle /faces/* url patterns.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -