• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

unable to load faces-config.xml

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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"><h:outputLabel value="UserName"></h:outputLabel> </td>
<td align="right"><p:inputText value="#{loginBean.userName}" styleId="userName"
title="Enter Username"></p:inputText></td>
</tr>

<tr class="password" >
<td align="right"><h:outputLabel value="Password"></h:outputLabel></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.
 
Ranch Hand
Posts: 514
1
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic