Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JavaServer Faces » Error getting property from bean
Error getting property from bean [message #474648] Mon, 25 June 2007 06:12 Go to next message
Eclipse User
Originally posted by: killahyo.gmail.com

Hello everybody, I'm developing a very simple example application and I'm
having some trouble with it... well, first of all I'll show you some code.

- faces-config.xml:
<?xml version='1.0' encoding='UTF-8'?>


<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">

<!-- =========== FULL CONFIGURATION FILE
================================== -->

<faces-config>

<managed-bean>
<description>
present
</description>
<managed-bean-name>present</managed-bean-name>

<managed-bean-class>udg.ada.cotxes.presentacio.ConPresentacio </managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>

</faces-config>
----------------------------------


- ConPresentacio.java:

package udg.ada.cotxes.presentacio;

import java.util.Vector;
import udg.ada.cotxes.negoci.*;

public class ConPresentacio {
String dni;
String model;
String color;

public ConPresentacio()
{
dni = new String();
model = new String();
color = new String();

}

public void setdni(String dniTreb)
{

dni = dniTreb;
}

public void setModel(String m)
{

model = m;
}

public void setColor(String c)
{

color = c;
}

public Vector CConcessionari()
{
negoci n = new negoci();

return n.CercaConcessionari(dni, model, color);
}

public Vector LlConcessionari()
{
negoci n = new negoci();

return n.LlConcessionaris(dni);
}

}
----------------------------------


- There is a presentation page, it provides a link to the main site, these
presentation page only has html code, so I won't post it here. The above
mentioned main site is index.jsp (go directly to JSF section):

<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%--
The taglib directive below imports the JSTL library. If you uncomment it,
you must also add the JSTL library to the project. The Add Library...
action
on Libraries node in Projects view can be used to add the JSTL 1.1 library.
--%>
<%--
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
--%>

<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<style>
BODY {
SCROLLBAR-FACE-COLOR: #555555; SCROLLBAR-HIGHLIGHT-COLOR: #333333;
SCROLLBAR-SHADOW-COLOR: #333333; SCROLLBAR-3DLIGHT-COLOR: #000000;
SCROLLBAR-ARROW-COLOR: #DDDDDD; SCROLLBAR-TRACK-COLOR: #999999;
SCROLLBAR-DARKSHADOW-COLOR: #000000;
}
</style>

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

<title>ADA Xarxa de Concessionaris</title>
<style type="text/css">
<!--

#Layer6 {
position:absolute;
width:500px;
height:150px;
z-index:3;
left:0px;
top: 0px;
background-image: url(Layer13.jpg);
overflow: visible;
background-image: url(Layer13.jpg);
}
#Layer7 {
position:absolute;
width:100px;
height:150px;
z-index:4;
left: 500px;
top: 0px;
background-image: url(Layer14Stripes.jpg);
background-image: url(Layer14Stripes.jpg);
}
#Layer8 {
position:absolute;
width:56px;
height:149px;
z-index:5;
left: 599px;
top: 0px;
background-image: url(Layer15Stripes.jpg);
background-image: url(Layer15Stripes.jpg);
}

Estilo2 {color: #FFFFFF; font-family: Arial, Helvetica, sans-serif;
font-size: 12px; font-weight: bold; }
Estilo3 {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #FFFFFF;
}
-->
</style>
</head>

<body bgcolor="#DDDEEF" background="Fons.jpg">
<div id="Layer8"></div>

<div id="Layer6"><img src="Title.jpg" alt="Site Title" width="500"
height="100" longdesc="Site Title" /></div>
<div id="Layer7">
<p>&nbsp; </p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</div>

<f:view locale="ca_ES" >
<br></br>
<br></br>
<br></br>
<br></br>
<hr />
<h:form>
<table width="100%" border="0" cellpadding="5" bordercolor="#FFFFFF" >
<tr>
<td>
<p class="formulari">DNI:</p>
<h:inputText id="dnitreballador" value="#{present.dni}"
required="true" maxlength="20" size="20" />
<h:message for="dnitreballador" showDetail="true"
style="color:red" styleClass="error"/>
</td>
</tr>
</table>

<br></br>
<h:commandButton id="submit" action="#{present.LlConcessionari}"
value="Cerca" styleClass="botogros" />
</h:form >
<hr />
</f:view>

</body>
</html>
----------------------------------

- and I get this error:

org.apache.jasper.JasperException: javax.servlet.jsp.JspException: Error
getting property 'dni' from bean of type
udg.ada.cotxes.presentacio.ConPresentacio
----------------------------------

Help me please! thank you very much
Re: Error getting property from bean [message #474649 is a reply to message #474648] Mon, 25 June 2007 09:07 Go to previous messageGo to next message
Yury Kats is currently offline Yury Kats
Messages: 104
Registered: July 2009
Senior Member
On 6/25/2007 6:12 AM, Sergi F.R wrote:
> public class ConPresentacio {
> String dni;
> String model;
> String color;
>
> public ConPresentacio()
> {
> dni = new String();
> model = new String();
> color = new String();
>
> }
>
> public void setdni(String dniTreb)
> {
>
> dni = dniTreb;
> }
>
> public void setModel(String m)
> {
>
> model = m;
> }
>
> public void setColor(String c)
> {
>
> color = c;
> }
>
> public Vector CConcessionari()
> {
> negoci n = new negoci();
>
> return n.CercaConcessionari(dni, model, color);
> }
>
> public Vector LlConcessionari()
> {
> negoci n = new negoci();
>
> return n.LlConcessionaris(dni);
> }
>
> }
>
> - and I get this error:
>
> org.apache.jasper.JasperException: javax.servlet.jsp.JspException: Error
> getting property 'dni' from bean of type
> udg.ada.cotxes.presentacio.ConPresentacio

Your bean is missing a getter (and a correct setter) for the 'dni'
property.

Int he future, you might want to ask general JSF question in the SUN's
jsf forum [1] or on MyFaces user list, depending on what JSF implementation
you're using. This newsgroup is mostly for discussion of JSF *tooling* in
Eclipse.

[1] http://forum.java.sun.com/forum.jspa?forumID=427
Re: Error getting property from bean [message #474650 is a reply to message #474649] Mon, 25 June 2007 13:38 Go to previous message
Eclipse User
Originally posted by: killahyo.gmail.com

Ok, problem solved, thanks and sorry to post this here.
Re: Error getting property from bean [message #612067 is a reply to message #474648] Mon, 25 June 2007 09:07 Go to previous message
Yury Kats is currently offline Yury Kats
Messages: 104
Registered: July 2009
Senior Member
On 6/25/2007 6:12 AM, Sergi F.R wrote:
> public class ConPresentacio {
> String dni;
> String model;
> String color;
>
> public ConPresentacio()
> {
> dni = new String();
> model = new String();
> color = new String();
>
> }
>
> public void setdni(String dniTreb)
> {
>
> dni = dniTreb;
> }
>
> public void setModel(String m)
> {
>
> model = m;
> }
>
> public void setColor(String c)
> {
>
> color = c;
> }
>
> public Vector CConcessionari()
> {
> negoci n = new negoci();
>
> return n.CercaConcessionari(dni, model, color);
> }
>
> public Vector LlConcessionari()
> {
> negoci n = new negoci();
>
> return n.LlConcessionaris(dni);
> }
>
> }
>
> - and I get this error:
>
> org.apache.jasper.JasperException: javax.servlet.jsp.JspException: Error
> getting property 'dni' from bean of type
> udg.ada.cotxes.presentacio.ConPresentacio

Your bean is missing a getter (and a correct setter) for the 'dni'
property.

Int he future, you might want to ask general JSF question in the SUN's
jsf forum [1] or on MyFaces user list, depending on what JSF implementation
you're using. This newsgroup is mostly for discussion of JSF *tooling* in
Eclipse.

[1] http://forum.java.sun.com/forum.jspa?forumID=427
Re: Error getting property from bean [message #612068 is a reply to message #474649] Mon, 25 June 2007 13:38 Go to previous message
Eclipse User
Originally posted by: killahyo.gmail.com

Ok, problem solved, thanks and sorry to post this here.
Previous Topic:Error getting property from bean
Next Topic:Best jsf version to use
Goto Forum:
  


Current Time: Sat Apr 19 13:20:20 EDT 2014

Powered by FUDForum. Page generated in 0.01748 seconds