Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Navigation does not work

 
sweety chala
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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">
<hutputText value="Name"></hutputText>
<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>

<hutputText value="Age" ></hutputText>
<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>

<hutputText value="Email"></hutputText>
<h:inputText id="i3" value="#{userDetails.email}" required="true" requiredMessage="Enter your mailId">
</h:inputText>

<!--<hutputText value="DOB"></hutputText>
<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>
<hutputText value="USER DETAILS"></hutputText>
<h:form id="userDetailsSubmitted">
<h:panelGrid columns="2">
<hutputText value="Name:"></hutputText>
<hutputText value="#{userDetails.name}"></hutputText>
<hutputText value="Age:"></hutputText>
<hutputText value="#{userDetails.age}"></hutputText>
<hutputText value="Email:"></hutputText>
<hutputText value="#{userDetails.email}"></hutputText>

</h:panelGrid>
</h:form>
</f:view>


</body>
</html>


Thanks in advance,
sweety
 
sweety chala
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any help towards this!!!
 
sumi sudha
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you post the business logic method, what are you returning in the method?
 
sweety chala
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public String submitUserDetails() {
return "submitted";
}
 
sweety chala
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would be very helpful if anyone of you could refer me atleast to some pointers !!!
 
Eswar Nec
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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/>
 
sweety chala
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this
 
sweety chala
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tried,,,,but
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic