wood burning stoves*
The moose likes JSF and the fly likes form and address do not match. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "form and address do not match." Watch "form and address do not match." New topic
Author

form and address do not match.

tuntun zaw
Greenhorn

Joined: Oct 23, 2007
Posts: 4
My welcome file is welcome.faces.When browser load welcome.faces,address bar show like
"http://localhost/tuntun/welcome.faces".When click the search buttom after filling text fields,following errors occur.

HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException:
javax.faces.el.PropertyNotFoundException: Error getting property 'tripType' from bean of type jsfclasses.flightsearch

org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:541)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:417)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:147)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)


My web service directory is apache tomcat.

welcome.faces

<html>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>

<f:view>
<head>
<title>Freedom Airlines Online Flight Reservation System</title>
</head>
<body>
<h:form>
<h2>Search Flights</h2>
<table>
<tr><td colspan="4">Where and when do you want to travel?</td></tr>
<tr>
<td colspan="2">Leaving from:</td>
<td colspan="2">Going to:</td>
</tr>
<tr>
<td colspan="2">
<h:inputText value="#{flight.origination}" size="35"/>
</td>
<td colspan="2">
<h:inputText value="#{flight.destination}" size="35"/>
</td>
</tr>
<tr>
<td colspan="2">Departing:</td>
<td colspan="2">Returning:</td>
</tr>
<tr>
<td>
<h:inputText value="#{flight.departDate}"/>
</td>

<td>
<h:inputText value="#{flight.departTime}"/>
</td>
<td>
<h:inputText value="#{flight.returnDate}"/>
</td>
<td>
<h:inputText value="#{flight.returnTime}"/>
</td>
</tr>
</table>
<p>
<h:commandButton value="Search" action="submit"/>
</p>
</h:form>
</body>
</f:view>
</html>

searchresult.faces

<html>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<f:view>
<head>
<title>Freedom Airlines Online Flight Reservation System</title>
</head>
<body>
<h3>You entered these search parameters</h3>
<p>Origination: <hutputText value="#{flight.origination}"/>
<p>Depart date: <hutputText value="#{flight.departDate}"/>
<p>Depart time: <hutputText value="#{flight.departTime}"/>
<p>Destination: <hutputText value="#{flight.destination}"/>
<p>Return date: <hutputText value="#{flight.returnDate}"/>
<p>Return time: <hutputText value="#{flight.returnTime}"/>
<p>Trip type : <hutputText value="#{flight.tripType}"/>
</body>
</f:view>
</html>

web.xml

<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>

faces-config.xml

<navigation-rule>
<from-view-id>/welcome.jsp</from-view-id>
<navigation-case>
<from-outcome>submit</from-outcome>
<to-view-id>/searchresult.jsp</to-view-id>
</navigation-case>
</navigation-rule>

<managed-bean>
<managed-bean-name>flight</managed-bean-name>
<managed-bean-class>jsfclasses.flightsearch</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>

<managed-property>
<property-name>origination</property-name>
<null-value/>
</managed-property>

<managed-property>
<property-name>destination</property-name>
<null-value/>
</managed-property>

<managed-property>
<property-name>departDate</property-name>
<null-value/>
</managed-property>

<managed-property>
<property-name>departTime</property-name>
<null-value/>
</managed-property>

<managed-property>
<property-name>returnDate</property-name>
<null-value/>
</managed-property>

<managed-property>
<property-name>returnTime</property-name>
<null-value/>
</managed-property>
</managed-bean>
Bob Good
Ranch Hand

Joined: Jan 09, 2008
Posts: 86
This error:

javax.faces.el.PropertyNotFoundException: Error getting property 'tripType' from bean of type jsfclasses.flightsearch


Means you have a managed bean / class called Flightsearch this is missing a method called:

getTripType(), which is a getter (accessor method) for a property called 'tripType'.
 
Don't get me started about those stupid light bulbs.
 
subject: form and address do not match.