|
-
June 22nd, 2010, 04:06 AM
#1
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
-
June 23rd, 2010, 03:09 PM
#2
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.
-
June 24th, 2010, 12:42 AM
#3
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
-
June 25th, 2010, 07:20 AM
#4
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|