Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

help regarding url-pattern in jsf

 
babai biswas
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,


i have a small issue which is regarding my jsf application. currently the login page can be access as http://localhost:7001/IAD/login.jsf hwever the requirement is to change it as http://localhost:7001/IAD/vecmgui/login.jsf . it tried changing the url-pattern for faces servlet as /vecmgui/*.jsf however it does not help. please find my original web.xml . can anyone help me to explain the changes

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<servlet>
<servlet-name>UtilsAndProperties</servlet-name>
<servlet-class>
com.qwest.ngs.servlet.iad.IADUtilServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet>
<servlet-name>IADVoip</servlet-name>
<servlet-class>com.qwest.ngs.servlet.iad.IADVoipGateServlet</servlet-class>
</servlet>

<servlet>
<servlet-name>IADFile</servlet-name>
<servlet-class>com.qwest.ngs.servlet.iad.IADFileServlet</servlet-class>
</servlet>

<!-- Faces Servlet -->
<servlet>
<servlet-name>FacesServlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- / -->

<security-constraint>
<web-resource-collection>
<web-resource-name>Success</web-resource-name>
<url-pattern>/voips/*</url-pattern>
<!--
<http-method>GET</http-method>
<http-method>PUT</http-method>
<http-method>POST</http-method>
-->
</web-resource-collection>
<auth-constraint>
<role-name>iadBvoipRole</role-name>
</auth-constraint>
</security-constraint>

<listener>
<listener-class>
com.sun.faces.config.ConfigureListener
</listener-class>
</listener>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>default</realm-name>
</login-config>

<security-role>
<role-name>iadBvoipRole</role-name>
</security-role>


<servlet-mapping>
<servlet-name>UtilsAndProperties</servlet-name>
<url-pattern>pingcheck</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>IADVoip</servlet-name>
<url-pattern>/voip/*</url-pattern>
</servlet-mapping>
<!--
<servlet-mapping>
<servlet-name>IADVoip</servlet-name>
<url-pattern>/voips/*</url-pattern>
</servlet-mapping>

-->

<servlet-mapping>
<servlet-name>IADFile</servlet-name>
<url-pattern>/@file.servlet.context.path@/*</url-pattern>
</servlet-mapping>

<!-- Faces Servlet Mapping (*.jsf files) -->
<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<!-- / -->

<!-- JSF-RI parameters (used during debug mode) -->
<context-param>
<param-name>com.sun.faces.verifyObjects</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.validateXml</param-name>
<param-value>true</param-value>
</context-param>
<!-- / -->

<!-- use .xhtml files to render views -->
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<!-- / -->

<!-- special debugging output (used in dev mode) -->
<context-param>
<param-name>facelets.DEVELOPMENT</param-name>
<param-value>true</param-value>
</context-param>
<!-- / -->

<!-- skip contextual comments -->
<context-param>
<param-name>facelets.SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>
<!-- / -->

<!-- Applicable Session Parameters -->
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<!-- / -->

<!-- First Rendered Page (for bootstrapping) -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!-- / -->
</web-app>
 
Hany Shafik
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't have asterisk in the middle of your URL pattern, asterisk must appear in the end or in the beginning of your URL pattern, so the URL pattern vecmgui/*.jsf is invalid one.
I suggest you have a directory named vecmgui and place your pages inside them.
 
babai biswas
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi hany,

Thanks a lot for your answer in javaranch. i have just a quick doubt, if i place my pages(xhtml and jsf) inside the folder vecmgui what should be the url pattern for facesservlet? can you explain me in little more detail. Actually i am very new to this topic
 
Hany Shafik
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Faces Servlet will be mapped to *.jsf .
 
babai biswas
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks i will try and let you know
 
babai biswas
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks that worked..thanks a lot. Just one more quick doubt , i have a requirement where the xhtml pages inside vecmgui directory only needs to get picked up by faces , not the pages inside the context root what i need to do. i tried changing the url-patterns to /vecmgui/* but it did not worked. any idea?
 
Hany Shafik
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It won't be picked up by the Faces servlet, since they don't end in *.jsf
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic