CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2008
    Posts
    26

    JSF 2.0 template problem

    I am learning JSF.
    I created a sample site using JSF template mechanism. My page structures are as below.

    /index.xhtml
    /register.xhtml
    /templates/masterTemplate.xhtml

    the files both index and register are using masterTemplate.xhtml. my project url is

    http://localhost/books/

    When I type http://localhost/books/ in the address bar of the browser I am getting the index.xhtml file correctly. I have a link to register.xhtml from the index page. When I click the linke browser goes to

    http://localhost/books/register.xhtml

    the problem what I am getting is.. The register.xhtml is displayed as a raw xml file. It is not getting templated. But if I change the url to look something like this

    http://localhost/books/faces/register.xhtml

    then the register.xhtml file works fine with template.

    What I am doing wrong here??
    Open SUSE 11 Linux
    with g++ compiler

  2. #2
    Join Date
    Feb 2008
    Posts
    966

    Re: JSF 2.0 template problem

    Check your faces-config.xml and your web.xml for entries that define how your pages are mapped. You probably have an entry in there somewhere that looks something like this:

    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    Now, the template works on the index because there is a separate entry that maps the default URL to the index.xhtml, so that is covered in the template.

  3. #3
    Join Date
    Jul 2008
    Posts
    26

    Re: JSF 2.0 template problem

    Yes I have the above entry in my web.xml file. Index.xhtml file is working fine.

    What should I do to get my other pages work?
    Open SUSE 11 Linux
    with g++ compiler

  4. #4
    Join Date
    Feb 2008
    Posts
    966

    Re: JSF 2.0 template problem

    You should just be able to get rid of the "/faces" and leave the "/*" and it should pick up everything from the root. This entry is telling the server where to expect all of the JSF style web pages, so if you leave it as /faces/* it is expecting everything to be under that URL pattern.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured