I have a jsf project
and my pages are all referencing a template.xhtml
currently i have the following in the web.xml
<welcome-file-list>
<welcome-file>/pages/home/index.xhtml</welcome-file>
</welcome-file-list>
when i try to access the root directory now it shows me some content from that page as jsf code (not rendered) but everything from within the template vanished as well. It just shows the title and 2 lines of code.
All help appreciated
Check the url mapping for the Faces Servlet in your web.xml file, it's probably wrong.
A good one should be like the one at the JSF tag info page:
<servlet>
<servlet-name>facesServlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>facesServlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
solved it
added the following in the web.xml
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
and created the following index.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="refresh" content="0; faces/pages/home/index.xhtml">
<title>Insert title here</title>
</head>
<body>
</body>
</html>
Related
I currently use mojarra javax.faces-2.2.8.jar and Apache Tomcat 6.0.26 Server.
I'm trying to add ajax behaviour to an input field(it's just for simplification).
Here is the simple facelets page(welcome.xhtml):
<?xml version="1.0" encoding="UTF-8" ?>
<!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:al = "http://xmlns.jcp.org/jsf/composite/AppearanceLibrary"
xmlns:h = "http://xmlns.jcp.org/jsf/html"
xmlns:ui = "http://xmlns.jcp.org/jsf/facelets"
xmlns:f = "http://xmlns.jcp.org/jsf/core">
<h:head/>
<h:body>
<h:form>
<h:outputLabel for = "login"
value = "login" />
<h:inputText id = "login" value = "#{authentication.submittedLogin}">
<f:ajax execute = "login" render = "out" />
</h:inputText>
<h:outputText id = "out" value = "#{authentication.submittedLogin}" />
</h:form>
</h:body>
</html>
Here is the HTML output:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head id="j_idt2"><script type="text/javascript" src="/JSFCars/javax.faces.resource/jsf.js.xhtml?ln=javax.faces&stage=Development"></script></head><body>
<form id="j_idt4" name="j_idt4" method="post" action="/JSFCars/welcome.xhtml" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="j_idt4" value="j_idt4" />
<label for="j_idt4:login">login</label><input id="j_idt4:login" type="text" name="j_idt4:login" onchange="mojarra.ab(this,event,'valueChange','j_idt4:login','j_idt4:out')" /><span id="j_idt4:out"></span><input type="hidden" name="javax.faces.ViewState" id="j_id1:javax.faces.ViewState:0" value="o5U6o+AhXUBnlwlaf5BbfJsXNxEe0OmBn+vyQUuLH1If1Hk802YaE1PT+ACraIlE+2rJMXEMJcDEgtaxMDURnPR0EFkR0Pdln4WoUMimfPxwbiCQCQcPfL+JDsPkyx+S6SvffiRyQFmz40B/lF5qtnt+AzzGhkYyuiuokiZVnJYv4hZBVhImLwKLm28dGvVh9qfnpnjngXm8cmAdIVULAY1sn1koFC2Bv702uBK0z9I6jHzMQFdPPCpBd5b+rri7R952i9cfi/CYGdcFSCq1yZGYL0s7E5Dshgaaikr5MVdJ4pRRQbiF60hypro+ZLavymy7G2pMukJNRaMhr7SxZffK13rGuCfpBXzXwdSeXZp2tMpWBhXJZ8gk/7rYzizmMgOTssZtj1inrPAgJdMSu2CJM2Q1xMV5wQSmSpU3bSHWdGknSMH4EGZsipKf8YCr3EsOSPD9khK8hlT5AmLm/iQ0j1xRHJny/6mIPJjVPPN/nD6AXBY+9bdt+SUPEKpT4u8in5ZulcG57t/9NUq/VA==" autocomplete="off" />
</form></body>
</html>
This is my deployment descriptor:
<?xml version = "1.0" encoding = "UTF-8"?>
<web-app xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
xmlns = "http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation = "http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
id = "WebApp_ID"
version = "3.1">
<context-param>
<param-name>
javax.faces.STATE_SAVING_METHOD
</param-name>
<param-value>
client
</param-value>
</context-param>
<context-param>
<param-name>
javax.servlet.jsp.jstl.fmt.localizationContext
</param-name>
<param-value>
resources.application
</param-value>
</context-param>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<listener>
<listener-class>
com.sun.faces.config.ConfigureListener
</listener-class>
</listener>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/welcome.xhtml</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>welcome.xhtml</welcome-file>
</welcome-file-list>
</web-app>
Inside the browser's JavaScript console I got the message that this request http://localhost:8086/JSFCars/javax.faces.resource/jsf.js.xhtml?ln=javax.faces&stage=Development failed with 404(Not found). And as the result when I try to invoke the input field's ajax behaviour I get the following message: Uncaught ReferenceError: mojarra is not defined.
I'm aware that I should use <h:head> and <h:body>, otherwise the jsf.js wasn't included in first place. I've tried several browsers and the results were the same. Also I've tried the myfaces-core-2.0.2-bin jsf implementation.
I has found very similar question here. The problem was connected with the user defined filter which rejected the js request. But I
don't define any filters in the web deployment descriptor. Might there be any implicitly defined filter that blocks that request? Or are there any other ideas why something blocks that request?
Since the time I asked this question I installed "GlassFish Server Open Source Edition 4.1.2"
server and deployed the application on it(I included "javax.faces-2.2.8.jar" into project libraries,
but I think the server uses the internal "Mojarra 2.2.14" JSF implementation). As the way of testing
of the JSF implementation I tried using a template, a composite componet. <ui:composition>, <ui:define>
tags and custom library inclusion work as needed. authentication bean is created and perfectly initialized using faces-congig.xml. Then after it I removed everything not related to
the question and left only welcome.xhtml page. Again I got "404 Not found".
The solution is to remove everything connected to faces servlet from the web.xml.
The view of the rendered welcome.xhtml page after applying the solution
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/welcome.xhtml</url-pattern>
</servlet-mapping>
is very weird.... This would mean nothing but your welcome page is loaded via the Faces servlet. So the jsf.js which has an .xhtml extension in the name as well as you posted yourself isn't either. Fix the url pattern (or remove all the faces servlet references since the defaults are most often fine) and everything will work
I don't know how to continue, but I always get the "java.lang.RuntimeException: Cannot find FacesContext" for my new JSF 1.2 web application. I'm sure it's just some configuration I can't find.
The exception occurs with the first f: or h: tag. Already with the important <f:view> at the beginning.
My index.jsp
<%# taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%# taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%#page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<f:view>
<html>
<head>
<title>MyWebsite</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
</head>
<body>
<div>MyContent</div>
</body>
</html>
</f:view>
My web.xml looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<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">
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.jsp</param-value>
</context-param>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>720</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
And then I also have a faces-config.xml that should reference myBean I want to use afterward in the body of the page:
<?xml version='1.0' encoding='UTF-8'?>
<faces-config version="1.2"
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-facesconfig_1_2.xsd">
<application>
<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
</application>
<managed-bean>
<managed-bean-name>myClassName</managed-bean-name>
<managed-bean-class>
com.company.className
</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
</faces-config>
What am I missing here?
java.lang.RuntimeException: Cannot find FacesContext
Thus, the JSF <f:xxx> and <h:xxx> tags are complaining that FacesContext cannot be found. The FacesServlet is the one responsible for creating the faces context. The faces servlet is invoked when the request URL matches its URL pattern, which is in your particular case *.jsf. So, when you open the index.jsp as http://localhost:8080/context/index.jsp, or are relying on the <welcome-file> setting, then you are not invoking the faces servlet and you would indeed get this exception.
You need to open the index.jsp as http://localhost:8080/context/index.jsf, or to set the welcome file entry to index.jsf in order to properly invoke the faces servlet, so that it can create the faces context which is required by the JSF components declared in the JSP page.
Note however that only fixing the welcome file isn't sufficient in this JSF 1.x + Tomcat environment. You also need to supply a physically existing, but completely empty index.jsf file next to the index.jsp file in the webcontent in order to fool Tomcat that index.jsf really exists as welcome file. It would otherwise show a 404 error because it checks the physical presence of the welcome file beforehand.
See also:
javax.faces.FacesException: java.lang.RuntimeException: Cannot find FacesContext
Unrelated to the concrete problem, I'm wondering why you're using JSP if you've apparently installed Facelets 1.x and registered its view handler. Facelets is far superior to JSP.
I am currently learning jsf. I have written A simple jsf application where my target is to navigate from one page to another page. However, I am unable to navigate at all.
In my code there are two jsp files; one is createcustomer.jsp and the other is viewCustomerDetails. After the user enters data in createcustomer.jsp and clicks on the button it should move to next page (where it will display entered data in previous page in this page).
Below is my code. Can anyone find where I'm going wrong?<
createCustomer.jsp
<%# page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%# taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%# taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<table>
<tr>
<td>
<h1 style="background-color:blue;color:white;">Create a new Customer</h1>
</td>
</tr>
</table>
<f:view>
<table>
<tr><td>Name:</td><td><h:inputText value="#{customer.name}"></h:inputText></td></tr>
<tr><td>Address:</td><td><h:inputText value="#{customer.address}"></h:inputText></td></tr>
<tr><td>Phone Number:</td><td><h:inputText value="#{customer.phNumber}"></h:inputText></td></tr>
<tr><td>Email Address:</td><td><h:inputText value="#{customer.email_id}"></h:inputText></td></tr>
</table>
<table>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td><h:commandButton value="Create Customer" action="viewCustomerDetails" /></td></tr>
</table>
</f:view>
</body>
</html>
face-config.xml
<faces-config
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-facesconfig_2_0.xsd"
version="2.0">
<managed-bean>
<managed-bean-name>customer</managed-bean-name>
<managed-bean-class>com.app.view.Customer</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>/createcustomer.jsp</from-view-id>
<navigation-case>
<!-- <from-action>#{customer.validate}</from-action> -->
<from-outcome>viewCustomerDetails</from-outcome>
<to-view-id>/viewCustomerDetails.jsp</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
<display-name>Customer</display-name>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>resources.application</param-value>
</context-param>
<context-param>
<description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<description>
This parameter tells MyFaces if javascript code should be allowed in
the rendered HTML output.
If javascript is allowed, command_link anchors will have javascript code
that submits the corresponding form.
If javascript is not allowed, the state saving info and nested parameters
will be added as url parameters.
Default is 'true'</description>
<param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<description>
If true, rendered HTML code will be formatted, so that it is 'human-readable'
i.e. additional line separators and whitespace will be written, that do not
influence the HTML code.
Default is 'true'</description>
<param-name>org.apache.myfaces.PRETTY_HTML</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<description>
If true, a javascript function will be rendered that is able to restore the
former vertical scroll on every request. Convenient feature if you have pages
with long lists and you do not want the browser page to always jump to the top
if you trigger a link or button action that stays on the same page.
Default is 'false'
</description>
<param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
<param-value>true</param-value>
</context-param>
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
</web-app>
Apparently, based on your code snipplet you have no <h:form> tag defined. Components such as <h:commandButton> need to be defined inside of one to function properly. Encase the content of your <f:view> inside an <h:form> and try again.
I am new in JSF and EJB applications, hence I encounter problems even in the simple JavaEE applications. I am creating a simple JavaEE application in eclipse with JBoss with goal just to try some tags of JSF and the binding of them to Java Beans. I cannot find out why the following JSf code does not get nothing appear to the output page:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
<f:loadBundle basename="resources" var="msg" />
<head>
<title><ui:insert name="pageTitle">Page Title</ui:insert></title>
<style type="text/css">
</style>
</head>
<body bgcolor="#ffffff">
<h:body>
<h:outputText value="#{hello.world}" />
<h:outputText value="TTT" />
</h:body>
</body>
</html>
Not only the value hello.world coming form Bean, but a simple text "TTT" does not appear as well. The code of the Bean is:
#ManagedBean
public class Hello {
final String world = "World";
/**
* Default constructor.
*/
public Hello() {
}
public String getWorld(){
return "Hello" + world;
}
}
The facelets-config.xml file is:
<?xml version="1.0" encoding="UTF-8"?>
<faces-config version="2.1" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xi="http://www.w3.org/2001/XInclude"
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-facesconfig_2_1.xsd">
<managed-bean>
<managed-bean-name>hello</managed-bean-name>
<managed-bean-class>com.al.jsftest.Hello</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
</faces-config>
When I try the tag with a plain text, it comes out on the screen, but it does not work again with #{hello.world}, namely the binding to the Bean fails. As soon as I have a have I hint to how get the JSF tag give successfully output, I would appreciate hint regarding what I should take care of, in order to get the Bean bind to JSF?
UPDATE:
It seems to be the same problem with similar question, but my application is in Eclipse with JBoss, not in Netbeans with GlassFish. I add therefore my web.xml file, probably a modification in that is required, but I still cannot figure out it.
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee /web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>JsfTest</display-name>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
You'll have to tell the server that your page should be loaded by the JSF-Servlet defined in your web.xml-file.
If I understand your sample right, you have a welcome file called index.xhtml which should be presented to the user with JSF by calling your website.
There is the problem:
All your pages won't be rendered by JSF unless you 'put them through' your defined JSF-Servlet.
Your servlet definition should look like this:
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern> /* !important */
</servlet-mapping>
And therefore you have two (there are more for sure :) ) ways to tell the server to load your page with the JSF-Servlet:
Tell your welcome-file to be loaded with the JSF-Servlet
<welcome-file-list>
<welcome-file>faces/index.xhtml</welcome-file> /* note the /faces/ prefix */
</welcome-file-list>
Extend your <url-pattern> inside the servlet-mapping
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
<url-pattern>*.xhtml</url-pattern> /*tell JSF to render all pages with xhtml-extension*/
</servlet-mapping>
Ther shouldn't be any difference between Netbeans+Glassfish and JBoss+eclipse but you should check if the JSF libraries are loaded by the server.
One last note:
You're configurating your Beans via faces-config.xml, that'll do the job but since JSF 2.x you're able to do the same inside your class via annotations, e.g.
#ManagedBean
#SessionScoped
public class TestBean {
// your stuff here
}
For me this is much easier and more readable.
Hope this helped, have Fun!
Edit:
After your comments I've tested your set-up: nothing wrong!
At first I've got an error because of the <f:loadBundle basename="resources" var="msg" /> which was not defined in my set-up but after deleting this line everything worked fine.
Nevertheless, I've made a small typo in my first list item so please check this again.
Your xhtml-skeleton looked fine for me and works in my test, so there shouldn't be anything wrong either.
Please check the following:
Are the JSF-libraries loaded either by the server or your application
Are there anymore Servlets defined inside your web.xml-file
What's the detailed error message
Cheers!
I created a new Dynamic Web Project and I added this time index.xhtml file using a "Blank Facelet Page" as template instead of "Common Facelet Page". I changed the url-pattern in my web.xml file as *.xhtml and it finally worked either by the full path name on the browser (\index.xhtml) or not. Following the same process with a "Common Facelet Page", I didn't manage to do it work. Strange.
I have also noticed, that after selecting "Common Facelet Page" and clicking next, a list of libraries appears and the user has the option to check some of them. I didn't check anything, maybe I should have.
When running my JSF "Hello World" in server I get a File download message box which says "do you want to save this file, or find a program online to open it" which has three options find, save and cancel. When I click on 'find' following message is shown
"Windows has the following information about this MIME type. This page will help you find software needed to open your file.
MIME Type: application/xhtml xml
Description: UnKnown
Windows does not recognize this MIME type."
my xhtml is
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
<title>Insert title here</title>
</h:head>
<h:body>
<f:view>
<h:outputText value="Hello World"></h:outputText>
</f:view>
</h:body>
</html>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<display-name>hospital</display-name>
<welcome-file-list>
<welcome-file>login.xhtml</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
</web-app>
If I run that particular xhtml file then its shown in IE. But any update to xhtml file will will be shown after refreshing the IE.
I am using Eclipse-helios IDE, Glassfish webserver. Thanks in advance
MSIE does indeed not support the content type of application/xhtml+xml. The page should be served with a content type of text/html (you can verify that with HTTP/web developer tools). But that should already be done by default JSF/Facelets configuration. You don't seem to have overridden the content type anywhere in the given code. One of the ways is defining it using the contentType attribute of the <f:view> tag. Another way is calling HttpServletResponse#setContentType() in some web filter. Or, completely different, perhaps it's been done afterwards by the webserver itself or by some proxy in the line.