hi

i am developing an application in jsf jpa using primefaces, i have a problem in logging in.

my web.xml file

Java Code:
<?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>Cation</display-name>
   <welcome-file-list>
        <welcome-file>index.jsp</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>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
  <listener>
    <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
  </listener>
</web-app>
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_1_2.xsd"
version="1.2">
<managed-bean>
<managed-bean-name>home</managed-bean-name>
<managed-bean-class>com.cation.action.LoginAction</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<navigation-rule>
<navigation-case>
<from-outcome>home_page</from-outcome>
<to-view-id>/pages/homePage.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>
index.jsp file

XML Code:
<jsp:forward page="faces/login.xhtml"></jsp:forward>
login.xhtml

<html xmlns="http://www.w3c.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.prime.com.tr/ui">
<h:head>
<link type="text/css" rel="stylesheet" href="themes/bluesky/skin.css" />
</h:head>
<h:body>
<center>
<p:panel header="Login Form" style="width: 350;">
<form>
<h:panelGrid columns="2" cellpadding="2">
<h:outputLabel for="#{home.username}" value="UserName"/>
<h:inputText value="#{home.username}" label="UserName"></h:inputText>
<h:outputLabel for="#{home.password}" value="Password"/>
<h:inputSecret value="#{home.password}"></h:inputSecret>
<h:commandButton type="submit" value="Login" action="#{home.validateUser}"></h:commandButton>
</h:panelGrid>
</form>
</p:panel>
<div><h:messages ></h:messages></div>
</center>
</h:body>
</html>

My login action file

package com.cation.action;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.Query;

import logon.Users;

public class LoginAction {

private String username;

private String password;

private static final String PERSISTENCE_UNIT_NAME = "Cation";

private static EntityManagerFactory factory;

@SuppressWarnings("unchecked")
public String validateUser() throws Exception {
factory = Persistence.createEntityManagerFactory(PERSISTENCE _UNIT_NAME);
EntityManager em = factory.createEntityManager();
// Read the existing entries and write to console
Query q = em.createQuery("SELECT u FROM Users u where u.Login='"+username+"'");
List<Users> userList = q.getResultList();
Users user = (Users) userList.get(0);

if(user == null){
return "error";
}
/*// Create new user
em.getTransaction().begin();
Users user = new Users();
user.setName("Tom Johnson");
user.setLogin("tomj");
user.setPassword("pass");
em.persist(user);
em.getTransaction().commit();

em.close();*/
return "home_page";
}

public String getUsername() {
return username;
}

public void setUsername(String username) {
this.username = username;
}

public String getPassword() {
return password;
}

public void setPassword(String password) {
this.password = password;
}
}

The problem is when i am logging in, the action shows success but it displays blank page with the same url

Can anyone plz help me to solve