aspose file tools *
The moose likes JSF and the fly likes unable to load faces-config.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "unable to load faces-config.xml " Watch "unable to load faces-config.xml " New topic
Author

unable to load faces-config.xml

prasad neena
Greenhorn

Joined: Jan 03, 2013
Posts: 11
Hi,

I have created a dynamic web project from eclipse-juno IDE for one of my JSF Application. Please find below my web.xml


<?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">

<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>

<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>
/WEB-INF/config/faces-config.xml,
</param-value>
</context-param>

<!-- Change to "Production" when you are ready to deploy -->

<!-- <context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param> -->

<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>

<session-config>
<session-timeout>30</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
</web-app>





please find below my index.xhtml file



<?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:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>login</title>


<title>Login</title>
<link rel="stylesheet" href="WebContent/stylesheets/design.css" type="text/css"></link>
<link rel="styleSheet" href="WebContent/stylesheets/newWeb.css" type="text/css" />
<script type="text/javascript" src="WebContent/scripts/jquery-1.7.1.min.js"></script>

<script type="text/javascript">

$(function(){
$('#submit').click(function(){
$('.password').show();

});
});



</script>
</h:head>




<h:body onload="focus_Field()">
<div id="wrapper">
<div id="header">
<img alt="" src="WebContent/images/logo_indx.png"></img>
<div class="toplinks">
<a href="#">Help?</a>
</div>
</div>
<div id="wrapperscnd">
<div id="components">
<div id="leftcomponent">
<h:form action="#">

<table cellpadding="3" align="center" cellspacing="4" border="0">
<tr class="userid">
<td align="right" height="32px"><hutputLabel value="UserName"></hutputLabel> </td>
<td align="right"><p:inputText value="#{loginBean.userName}" styleId="userName"
title="Enter Username"></p:inputText></td>
</tr>

<tr class="password" >
<td align="right"><hutputLabel value="Password"></hutputLabel></td>

<td align="right"><p:password value="#{loginBean.password}"
title="Enter Password"></p:password></td>
</tr>
<tr class="submit">
<td></td>



<td align="left" ><p:commandButton value="Login" styleClass="button1" action="#{loginBean.login}" ></p:commandButton>
</td>
</tr>

</table>
</h:form>
</div>
<div id="rightcomponents">
<p>
Strengthen the Authentication & Authorisation strategy for
controlling access to the Devices, Networks and Applications<br />
<br /> <span><a href="#">Self Help</a> </span>
</p>
</div>
<div class="footer">
<div class="leftfoot">
<img src="WebContent/images/logobotm.png" />
</div>
</div>
</div>
</div>
</div>
</h:body>
</html>





please find below my faces-config.xml file




<?xml version="1.0" encoding="UTF-8"?>
<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">

<application>
<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>

<resource-bundle>
<base-name>ApplicationResource</base-name>
<var>app</var>
</resource-bundle>

</application>

<!--****************Managed Bean Conf*******************-->
<managed-bean>
<managed-bean-name>loginBean</managed-bean-name>
<managed-bean-class>com.mq.updatemanager.web.login.LoginBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
</faces-config>



please find below my LoginBean class



/**
*
*/
package com.mq.updatemanager.web.login;

/**
* @author seetharam.vadapally
*
*/
public class LoginBean {
private String userName;
private String password;
/**
* @return the userName
*/
public String getUserName() {
return userName;
}
/**
* @param userName the userName to set
*/
public void setUserName(String userName) {
this.userName = userName;
}
/**
* @return the password
*/
public String getPassword() {
return password;
}
/**
* @param password the password to set
*/
public void setPassword(String password) {
this.password = password;
}
public String login(){
System.out.println("1");
return "login";
}

}



when I execute index.xhtml file i am not able to load bean properties from faces-config.xml file. Whereas the same set of files works well for tomcat project created in eclipse -juno IDE.
Kindly let me know if I am missing anything.
Any help would be greatly appreciated.


Thanks
Prasad.
Volodymyr Levytskyi
Ranch Hand

Joined: Mar 29, 2012
Posts: 505
    
    1

<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>
/WEB-INF/config/faces-config.xml,
</param-value>
</context-param>

Maybe removing comma from path to faces-config wil help


True person is moral, false is right!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: unable to load faces-config.xml