aspose file tools*
The moose likes JSF and the fly likes How do I start a web application on an xhtml page? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "How do I start a web application on an xhtml page?" Watch "How do I start a web application on an xhtml page?" New topic
Author

How do I start a web application on an xhtml page?

Alejandro Barrero
Ranch Hand

Joined: Aug 01, 2005
Posts: 319
I am learning RichFaces, but I cannot run a test application starting with echo.xhtml. In my web.xml I have as a welcome file index.html with

In my web.xml file I have

The suffix jsf should identify the pages in the application. However the browser displays with URL http://localhost:8080/Echo/ and an error message
The requested resource () is not available.
It cannot find a page with the name echo.jsf.

Your help will be greatly appreciated,

Alejandro Barrero

Your help will be greatly appreciated,
Alejandro Barrero
suresh dasari
Ranch Hand

Joined: Oct 05, 2009
Posts: 121

Alejandro,

I think the application is finding for a file with default extension i.e., .jsp file.
change the default suffix to .xhtml and run the application.



Sun Certified Java Programmer with 93 percent
Alejandro Barrero
Ranch Hand

Joined: Aug 01, 2005
Posts: 319
Thanks Suresh, but it didn't work. Do you have a web.xml that works for you?
Nick Potter
Ranch Hand

Joined: May 07, 2008
Posts: 126
You also need to configure the facelets view handler in faces-config, because jsf comes by default with jsp.


And change your jsf servlet url pattern to *.xhtml
Alejandro Barrero
Ranch Hand

Joined: Aug 01, 2005
Posts: 319
Thank you Nick, but still it doesn't work. I copied the project from http://www.ibm.com/developerworks/web/library/j-richfaces/. The project's war file runs fine, but I had the same error in Eclipse and JBoss Developer studio. After I added <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>, faces-config.xml is

web.xml is
Nick Potter
Ranch Hand

Joined: May 07, 2008
Posts: 126


Here is your problem, you need to change it to *.xhtml. Also in your forwarding page, forward to a .xhtml page.

Nevermind that, it should work with .jsf too.

Post the stack trace that you get in your server logs.
Nick Potter
Ranch Hand

Joined: May 07, 2008
Posts: 126


I think you'll get an error here, so better remove it, since you'ce already configured a view handler.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16303
    
  21

It's generally a problem getting the server to invoke JSF (or Struts) pages directly from web.xml specs. This applies to not only the welcome page, but also to things like the login/loginfail pages. The reason has to do with the fact that internal requests don't set up all the necessary infrastructure to properly invoke the FacesServlet.

You can get around this by making the welcome page be a standard JSP with a redirect to the JSF welcome page on it.


Customer surveys are for companies who didn't pay proper attention to begin with.
Alejandro Barrero
Ranch Hand

Joined: Aug 01, 2005
Posts: 319
Thanks Tim, but I must be doing something else wrong. In my case the input is index.html.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16303
    
  21

Alejandro Barrero wrote:Thanks Tim, but I must be doing something else wrong. In my case the input is index.html.


Never let it be said that I can't miss the obvious. But can your fetch the echo.jsf page directly? If not, you've got a JSF problem. If you can, the problem is with the welcome page.
Nick Potter
Ranch Hand

Joined: May 07, 2008
Posts: 126
We use an html page that forwards to jsf in our project, so he definitely does something wrong, it's not a jsf issue (at least not in jsf 1.2). The server logs will need to be checked out.
Alejandro Barrero
Ranch Hand

Joined: Aug 01, 2005
Posts: 319
The message in the web page is The requested resource () is not available.

I don't get anything in the Tomcat log.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do I start a web application on an xhtml page?