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
how can remove application name wompower6 , url becomes mysitename.com/home ?
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.
rename war file
root.war
, tomcat default deploy on context root.set
path
attribute of<context>
element inwebapp/meta-inf/context.xml
(ortomcat/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:
provide physically existing
/faces/home.xhtml
file (it can left empty).replace ugly
/faces/*
url pattern offacesservlet
mapping inweb.xml
*.xhtml
kick in on every request xhtml file.<url-pattern>*.xhtml</url-pattern>
this way don't need fiddle
/faces/*
url patterns.
Comments
Post a Comment