| Author |
Navigation does not work
|
sweety chala
Greenhorn
Joined: Jun 24, 2010
Posts: 6
|
|
Hi all,
When I click on the submit button the navigation does not happen and it stays in the same page.Could anyone help me in this?
I have attache the code piece:
UserDetailsForm.jsp
<f:view>
<h:messages style="color:blue"></h:messages>
<h:form>
<h:panelGrid columns="2">
<h utputText value="Name"></h utputText>
<h:inputText id="i1" value="#{userDetails.name}" required="true" requiredMessage="Please enter your name"
validatorMessage="Please enter more than three characters for the name">
<f:validateLength minimum="3"/>
</h:inputText>
<h utputText value="Age" ></h utputText>
<h:inputText id="i2" value="#{userDetails.age}" required="true" requiredMessage="Please enter your age"
validatorMessage="Please enter correct age">
<f:validateLongRange minimum="0" maximum="100"></f:validateLongRange>
</h:inputText>
<h utputText value="Email"></h utputText>
<h:inputText id="i3" value="#{userDetails.email}" required="true" requiredMessage="Enter your mailId">
</h:inputText>
<!--<h utputText value="DOB"></h utputText>
<h:inputText id="i4" value="#{userDetails.DOB}" required="true" requiredMessage="Enter your D-O-B" >
<f:convertDateTime type="date" pattern="MM/DD/YYYY"/>
</h:inputText>-->
</h:panelGrid>
<h:commandButton type="submit" value="Submit" action="#{userDetails.submitUserDetails}"></h:commandButton>
</h:form>
</f:view>
faces-config.xml
<?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>userDetails</managed-bean-name>
<managed-bean-class>com.user.details.UserDetails</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>/pages/UserDetailsForm.jsp</from-view-id>
<navigation-case>
<from-outcome>submitted</from-outcome>
<to-view-id>/pages/UserDetailsSubmitted.jsp</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>
UserDetailsSubmitted.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>
<f:view>
<h utputText value="USER DETAILS"></h utputText>
<h:form id="userDetailsSubmitted">
<h:panelGrid columns="2">
<h utputText value="Name:"></h utputText>
<h utputText value="#{userDetails.name}"></h utputText>
<h utputText value="Age:"></h utputText>
<h utputText value="#{userDetails.age}"></h utputText>
<h utputText value="Email:"></h utputText>
<h utputText value="#{userDetails.email}"></h utputText>
</h:panelGrid>
</h:form>
</f:view>
</body>
</html>
Thanks in advance,
sweety
|
 |
sweety chala
Greenhorn
Joined: Jun 24, 2010
Posts: 6
|
|
|
Any help towards this!!!
|
 |
sumi sudha
Greenhorn
Joined: Jan 27, 2010
Posts: 14
|
|
|
can you post the business logic method, what are you returning in the method?
|
 |
sweety chala
Greenhorn
Joined: Jun 24, 2010
Posts: 6
|
|
public String submitUserDetails() {
return "submitted";
}
|
 |
sweety chala
Greenhorn
Joined: Jun 24, 2010
Posts: 6
|
|
|
It would be very helpful if anyone of you could refer me atleast to some pointers !!!
|
 |
Eswar Nec
Ranch Hand
Joined: May 02, 2010
Posts: 105
|
|
Hi,
I check your code . I create a new project and integrate your code in netbeans ide. Its perfectly worked.
Try to change and check <managed-bean-scope/>
|
Wake up! Don't let your smile be snatched away by anybody!
Regards, Eswar
|
 |
sweety chala
Greenhorn
Joined: Jun 24, 2010
Posts: 6
|
|
Thanks Anywayzz it does not work!!!
I have created a dynamic web project.
Now I tried with normal Java Project and the Navigation works.I really dont understand what was the problem with dynmaic web project creation.
I may understand it in the furure
|
 |
Eswar Nec
Ranch Hand
Joined: May 02, 2010
Posts: 105
|
|
Try this
|
 |
sweety chala
Greenhorn
Joined: Jun 24, 2010
Posts: 6
|
|
Tried,,,,but
|
 |
 |
|
|
subject: Navigation does not work
|
|
|