-
1. Re: Why Is .XHTML file trying to call .JSP file in Rich Faces Project?
harut Mar 12, 2010 2:32 AM (in response to jabailo)Hi, can you post the web.xml -
2. Re: Why Is .XHTML file trying to call .JSP file in Rich Faces Project?
jabailo Mar 12, 2010 12:29 PM (in response to harut)Web.xml
<?xml version="1.0"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>richfaces-start</display-name>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<!-- Faces Servlet -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Faces Servlet Mapping -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
</web-app> -
3. Re: Why Is .XHTML file trying to call .JSP file in Rich Faces Project?
sergeysmirnov Mar 12, 2010 12:35 PM (in response to jabailo)according to your web.xml, you do not use facelet view handler that has a deal with xhtml pages. So, the default JSP view handler is used on your side. -
4. Re: Why Is .XHTML file trying to call .JSP file in Rich Faces Project?
jabailo Mar 12, 2010 12:40 PM (in response to sergeysmirnov)Can you tell me what I should add specifically?
I'm a newbie to JSF; trying to learn.
-
5. Re: Why Is .XHTML file trying to call .JSP file in Rich Faces Project?
sergeysmirnov Mar 12, 2010 1:02 PM (in response to jabailo)pretty old, but still a good article about richfaces + facelets is here: http://www.ibm.com/developerworks/java/library/j-richfaces/index.html
Just update the versions of the libs. In general, using a Maven makes life much easy in terms of the dependedcy and version control.
-
6. Re: Why Is .XHTML file trying to call .JSP file in Rich Faces Project?
jabailo Mar 12, 2010 1:12 PM (in response to sergeysmirnov)I also found this article
http://www.jsfcentral.com/articles/facelets_2.html
And they both say to add
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>To web.xml
However, now when I right-click on my users.xhtml file in Eclipse, it brings up this error report:
type Status report
message /richfaces-start/users.jsf
description The requested resource (/richfaces-start/users.jsf) is not available.
So, now it is looking for a .jsf file (which I have not built).
Here is my current web.xml file with the new entry highlighted
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>richfaces-start</display-name>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<!-- Faces Servlet -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Faces Servlet Mapping -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
</web-app> -
7. Re: Why Is .XHTML file trying to call .JSP file in Rich Faces Project?
jabailo Mar 12, 2010 1:45 PM (in response to jabailo)Ok, now it gets wierder...
As a test, I added a simple index.html file to see if it could run that.
On right-click index.html debug, the answer initially was that it could not find index.html !
Then I waited a few more seconds after the startup and tried again...it ran!
Then, I tried calling my users.xhtml file -- this time it brought up a Firefox dialog asking me to run or save.
I picked Run and it launched!
My next problem is that it shows the hard coded text in the .xhtml, but not the dynamic text that should be called from the bean.
However, I think that is another thread...
-
8. Re: Why Is .XHTML file trying to call .JSP file in Rich Faces Project?
sergeysmirnov Mar 12, 2010 2:20 PM (in response to jabailo)You have to use users.jsf instead of user.xhtml as a part of URL in your browser. This is like JSF mapping work. Aside the security issues, direct access to xhtml means no jsf interpritation. -
9. Re: Why Is .XHTML file trying to call .JSP file in Rich Faces Project?
jabailo Mar 12, 2010 2:31 PM (in response to sergeysmirnov)I removed the default mapping (in web.xml) so now it is back to the original web.xml that the Eclipse/JBoss/Richfaces template generated.
If I right click on users.xhtml and select debug, the following happens:
In Eclipse it attempts to run the file http://localhost:8080/richfaces-start/users.jsf
The error HTTP 404, users.jsp is not available appears.
I did not create either a jsf or a jsp -- but Eclipse seems to assume that these exist.
Can I assume that the jsf and/or jsp is supposed to be generated "on the fly"?
Or should I be creating a jsf? Or jsp? Or both? Instead of xhtml?
-
10. Re: Why Is .XHTML file trying to call .JSP file in Rich Faces Project?
sergeysmirnov Mar 12, 2010 2:48 PM (in response to jabailo)I guess, the "Eclipse/JBoss/Richfaces template" generated non-facelets project where jsp pages are used.
As soon as the runtime still claims users.jsp is missing, you still has no facelets properly configures in your project.
If you use the facelets, you have to use the files with .xhtml extention. Otherwize, if it is a pure jsf, the .jsp files should be used.
You should never ever create a file with .jsf extention. .jsf is just an 'alias' that the view handler uses to invoke the actual 'jsp' (non-facelets) or 'xhtml' (facelets) files.
-
11. Re: Why Is .XHTML file trying to call .JSP file in Rich Faces Project?
jabailo Mar 12, 2010 4:13 PM (in response to sergeysmirnov)What seems to work best is if I put in an index.html page with a hyperlink to the users.xhtml page.
I then start the index.html page in debug and click to the users.xthml page -- which from Eclipse launches into a Firefox browser.
I still can't figure out though why my dynamic JSF is not rendering.
I have a rich:dataTable loop but it doesn't show the records in the user class.
I tried setting breakpoints in the class but it doesn't seem to fire on calling the jsf/xhtml page.
Here is users.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j"
>
<head>
<title>RichFaces</title>
</head>
<body>
<h:form>
<rich:panel>
<f:facet name="header">
Just some users <!-- This is all that displays -->
</f:facet>
<rich:dataTable value="#{userBean.users}" var="user">
<h:column>
<h:outputText id="name" value="#{user.name}"/>
</h:column>
<h:column>
<h:outputText id="email" value="#{user.email}"/>
</h:column>
</rich:dataTable>
</rich:panel>
</h:form>
</body></html> -
12. Re: Why Is .XHTML file trying to call .JSP file in Rich Faces Project?
jabailo Mar 12, 2010 4:53 PM (in response to jabailo)Well, it looks to me the RichFaces statements are not rendering dynamically.
They are simply coming through as static pages as is...
-
13. Re: Why Is .XHTML file trying to call .JSP file in Rich Faces Project?
sergeysmirnov Mar 12, 2010 4:54 PM (in response to jabailo)The JSF content is not rendered, because you do not use jsf at all in the configuration you have.
You have to have a link to users.jsf in the index.html, but not users.xhtml.
Btw, have you added facelets view handler declaration in the faces-config.xml ?
-
14. Re: Why Is .XHTML file trying to call .JSP file in Rich Faces Project?
jabailo Mar 12, 2010 5:07 PM (in response to sergeysmirnov)I use a link to users.xhtml
I have .xhtml defined in a <context-param> as the javax.faces.DEFAULT_SUFFIX
According to the article you posted:
Normally, Facelets requires another overriding entry for the view handler in faces-config.xml, but the RichFaces setup, as you'll see below, includes the override in web.xml.