You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "Zheng, Xiahong" <Xi...@FMR.COM> on 2007/12/17 22:26:01 UTC

How do I configure JSF application to use URLs without a suffix?

I know it must be possible. But I don't seem to be able to get it to
work. It looks like if you use suffix based URL mapping in your web.xml
like the following
 
<servlet-mapping>
    <serlvet-name>Faces Servlet</servlet-name>
    <url-pattern>*.faces</url-pattern>
</servlet-mapping>
 
You URL will have to end up with .faces suffix like
/myapp/welcome.faces. In this case, the suffix will be replaced by .jsp
before rendering. I would like to use path based mapping such as
 
<servlet-mapping>
    <serlvet-name>Faces Servlet</servlet-name>
    <url-pattern>/sample/*</url-pattern>
</servlet-mapping>
 
and be able to use URL like /myapp/sample/welcome. However, it does not
work, because in this case, there is no attempt by the framework to add
the default suffix .jsp to the viewId, as a result, I got a 404 resource
not available error.


Re: How do I configure JSF application to use URLs without a suffix?

Posted by Andrew Robinson <an...@gmail.com>.
I think you can do it with facelets. Just create your files without an
extension.

You may also be able to do it with a custom view handler.

On Dec 17, 2007 2:26 PM, Zheng, Xiahong <Xi...@fmr.com> wrote:
>
>
> I know it must be possible. But I don't seem to be able to get it to work.
> It looks like if you use suffix based URL mapping in your web.xml like the
> following
>
> <servlet-mapping>
>     <serlvet-name>Faces Servlet</servlet-name>
>     <url-pattern>*.faces</url-pattern>
> </servlet-mapping>
>
> You URL will have to end up with .faces suffix like /myapp/welcome.faces. In
> this case, the suffix will be replaced by .jsp before rendering. I would
> like to use path based mapping such as
>
>
> <servlet-mapping>
>     <serlvet-name>Faces Servlet</servlet-name>
>     <url-pattern>/sample/*</url-pattern>
> </servlet-mapping>
>
> and be able to use URL like /myapp/sample/welcome. However, it does not
> work, because in this case, there is no attempt by the framework to add the
> default suffix .jsp to the viewId, as a result, I got a 404 resource not
> available error.
>

Re: How do I configure JSF application to use URLs without a suffix?

Posted by Samba <sa...@gmail.com>.
Search on Google for JSF URL Masking , you'll get a link which tells you how
to over ride  the View handler to remove the suffix or prefix of a JSF Page
URL it's worth the effort. But right now I don't have the exact details.

I used it once in  my earlier project (earlier company ,as well), but I do
not have it at my possession, right now to help you.


On Dec 18, 2007 7:17 AM, Stephen Friedrich <tr...@eekboom.com> wrote:

> I use tuckey to rewrite urls to the suffix form and back:
> http://tuckey.org/urlrewrite/
>



-- 
Regards...
Samba.

Re: How do I configure JSF application to use URLs without a suffix?

Posted by Stephen Friedrich <tr...@eekboom.com>.
I use tuckey to rewrite urls to the suffix form and back:
http://tuckey.org/urlrewrite/

Re: How do I configure JSF application to use URLs without a suffix?

Posted by Zigc Junk <zi...@gmail.com>.
I guess your welcome.jsp should be

/myapp/welcome.jsp

Then, you can get to it via

http://yourhost/sample/welcome.jsp

Bill

On Dec 17, 2007 3:26 PM, Zheng, Xiahong <Xi...@fmr.com> wrote:

>  I know it must be possible. But I don't seem to be able to get it to
> work. It looks like if you use suffix based URL mapping in your web.xmllike the following
>
> <servlet-mapping>
>     <serlvet-name>Faces Servlet</servlet-name>
>     <url-pattern>*.faces</url-pattern>
> </servlet-mapping>
>
> You URL will have to end up with .faces suffix like /myapp/welcome.faces.
> In this case, the suffix will be replaced by .jsp before rendering. I would
> like to use path based mapping such as
>
>  <servlet-mapping>
>     <serlvet-name>Faces Servlet</servlet-name>
>     <url-pattern>/sample/*</url-pattern>
> </servlet-mapping>
>
> and be able to use URL like /myapp/sample/welcome. However, it does not
> work, because in this case, there is no attempt by the framework to add the
> default suffix .jsp to the viewId, as a result, I got a 404 resource not
> available error.
>