Yes I know that but the attributes must be public because
we are using VBSF who manage all the database access/retrieve ...
We have 2 ways for using VBSF :
- set the attributes public
- defined new get / set for all the attributes.
(we have already all the get and set but they were changed for the jsp
pages
like this :
public String getContract_id()
{
// contact_id is a Integer ...
if (contract_id == null)
return "";
else
return String.valueOf(contract_id);
}
And we have no more time to change this now ... :(
but do you have an idea why :
<INPUT TYPE="text" NAME="payment_method" VALUE="<jsp:getProperty
name="contract" property="Payment_method" />" >
don't work
and why this works :
<INPUT TYPE="text" NAME="payment_method"
VALUE="<%=contract.getPayment_method()%>" >
???
the getProperty returns "" and the getPayment_method() returns the
correct value ... ?
Thanks
Thierry
-----Message d'origine-----
De : Jann VanOver [mailto:[EMAIL PROTECTED]]
Envoy� : mercredi 2 mai 2001 1:23
� : [EMAIL PROTECTED]
Objet : Re: Difference between bean.field and <jsp:getProperty
name="bean " property="field" />
I'm not sure why it isn't working, but to be a "good" bean, your
attributes
contract_id and payment_method should be private, not public. This
answers
your original question -- <jsp:getProperty is MUCH preferred over
beanname.propertyname because the latter does an end-run around the
bean.
-----Original Message-----
From: BERWART Thierry [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 26, 2001 12:15 AM
To: [EMAIL PROTECTED]
Subject: Re: Difference between bean.field and <jsp:getProperty
name="bean " property="field" />
Hi,
I have already tested it but without success :/
when I use
<INPUT TYPE="text" NAME="payment_method" VALUE="<jsp:getProperty
name="contract" property="payment_method" />" >
it displays nothing in my textedit
but when I use directly contract.payment_method, it works !!!
Any ideas ? ;)
Thierry
-----Message d'origine-----
De : Rishabh Agarwal [mailto:[EMAIL PROTECTED]]
Envoy� : jeudi 26 avril 2001 8:51
� : [EMAIL PROTECTED]
Objet : Re: Difference between bean.field and <jsp:getProperty
name="bean " property="field" />
U have the method as getPayment_method(). U have to use:
<INPUT TYPE="text" NAME="payment_method" VALUE=
"<jsp:getProperty
name="contract" property="Payment_method" />" >
to get the correct value. Lemme know if it doesn't work.
Rishabh.
-----Original Message-----
From: BERWART Thierry
[mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 26, 2001 2:27 PM
To: [EMAIL PROTECTED]
Subject: Difference between bean.field and
<jsp:getProperty name="bean" property="field" />
Hello,
I have a JSP page and a bean.
When I want to display some fields of this bean for
editing,
I used this :
<INPUT TYPE="text" NAME="payment_method" VALUE=
"<jsp:getProperty
name="contract" property="payment_method" />" >
but it display nothing as if "payment_method" is null or
is
"".
I change this code with this :
<INPUT TYPE="text" NAME="payment_method" VALUE= "<%=
(contract.payment_method != null) ?
contract.payment_method
: "" %>"
SIZE=30 MAXLENGTH=40>
and it's working !!! it displays the value of the
"payment_method" field
Do you have an idea ?
What is better to use ? bean.field or <jsp:getProperty
....
???
Thanks you
Thierry
PS :
A part of my bean :
public class Contract {
//attributes
private StringBuffer error_message = null;
public Integer contract_id;
.....
public String payment_method;
.....
public String getPayment_method()
{
return payment_method;
}
public void setPayment_method(String
newPayment_method)
{
payment_method = newPayment_method;
}
========================================================================
===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets