Use of JSF view in welcome file list
Hello, I am trying to configure a welcome file list in my Tomcat-deployed web app so that a Java Server Faces (JSF) view is used as the welcome file. My web.xml file contains the following: main.faces As well as the following JSF servlet configurations: FacesServlet javax.faces.webapp.FacesServlet FacesServlet *.faces I have been unable to get this working no matter what I have tried. Whenever I request a directory within the web application's context, Tomcat shows a directory listing instead of the JSF view I've identified in the welcome file list. Can anyone explain why this is not working and, more importantly, what I must do to use JSF views as my welcome page(s)? Thanks, - Tim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Use of JSF view in welcome file list
Peter, Thanks for the example: I had seen examples like this in the archives, which is why I thought that I could do what I'm trying to do: I want the same kind of behavior you are describing, but with a mapping to the Faces servlet instead. If the examply you've provided works, any ideas why my JSF setup would not work? In my environment, I request "http://localhost:8080/pdm/main.faces";, which works fine. If I instead request "http://localhost:8080/pdm/";, it instead shows me a directory listing of the files in my web app. Is there a problem with using a wildcard in my JSF servlet mapping that causes it to fail with welcom files? Or is there something inherently odd with JSF that makes this impossible to do? Thanks, - Tim -Original Message- From: Peter Menzel <[EMAIL PROTECTED]> Sent: Nov 8, 2005 6:48 AM To: Tomcat Users List Subject: Re: Use of JSF view in welcome file list Charlie C.L. King wrote: > you *MUST* use real files in instead of a mapped path. > Actually this is not true. In the you specify only partial URIs in the Elements. If the Container encounters a request, which does not map to a in the DD, it appends each in the order appearing in the list to this partial request and looks, if there is a static file OR a which matches the modified request. If yes, then this request will be processed. Therefore the first matching wins. If no matches, the container may show a directory listing or 404. Welcome files may not contain leading or trailing slashes. working example: Home my.servlet.Home Home /home home If a request comes to http://example.com/mywebapp/ , the container appends "home" to the partial request "/" and matches "/home". The my.servlet.Home gets the request. See servlet Spec SRV 9.10 for more details. Peter Menzel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Use of JSF view in welcome file list
Thanks for the info, Peter. I'm somewhat new to using Tomcat, so if there's somewhere particular I should post this as a bug, please let me know. It is at least comforting to know that I can work around this by avoiding the use of a wildcard mapping to the JSF servlet. Thanks, - Tim -Original Message- From: Peter Menzel <[EMAIL PROTECTED]> Sent: Nov 8, 2005 10:07 AM To: Tomcat Users List Subject: Re: Use of JSF view in welcome file list Tim Dean wrote: > Peter, > > Thanks for the example: I had seen examples like this in the archives, which > is why I thought that I could do what I'm trying to do: I want the same kind > of behavior you are describing, but with a mapping to the Faces servlet > instead. > > If the examply you've provided works, any ideas why my JSF setup would not > work? In my environment, I request "http://localhost:8080/pdm/main.faces";, > which works fine. If I instead request "http://localhost:8080/pdm/";, it > instead shows me a directory listing of the files in my web app. > > Is there a problem with using a wildcard in my JSF servlet mapping that > causes it to fail with welcom files? Or is there something inherently odd > with JSF that makes this impossible to do? > > Thanks, > > - Tim Actually, I never worked with Faces before, so I can't tell. Therefore I tried with a normal servlet and wildcard extension: Home *.bar foo.bar and: accessing http://localhost/mywebapp/ prints the directory listing ! Unfortunately, that is not what I expected. Tomcat should have appended "foo.bar" to "/" resulting in "/foo.bar" and should then match Home servlet to this request. Using this mapping Home /foo.bar Tomcat is invoking the Home Servlet. So this looks not like a specific JSF problem. It looks like a bug in Tomcat? The Servlet spec states: "The web server must append each welcome file in the order specified in the DD to the partial request and check whether a static resource or servlet in the WAR is mapped to that request URI." Peter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]