Hello I have a big problem :
I have a bean "contract" with these variables :
Integer contract_id
Date validity_start_date
Date creation_date
String payment_method
( + all the get and set methods)
I have 2 pages one to ask to the user to fill some field in an html form
and another to insert the bean in the database and to put this in a
vector of contracts.
All works perfectly and the bean inserted in the vector contains a
contract_id (filled by the db)
and a creation_date (filled by the db).
When I want to edit a contract, I have a page with a list of contract, I
select one.
And my JSP page get the bean from the vector and display some
informations :
<jsp:useBean id ="contract" scope="session"
class="be.eTrust.trustedSeal.service.bean.Contract" />
...
<HTML>
<BODY>
<% out.println("contract_id : " + contract.contract_id); %>
<%
String id = request.getParameter("id");
if (id != null && (id.equals("") == false) )
{
Vector contractVector = (Vector)
session.getAttribute("contractVector");
int i = Integer.parseInt(id);
contract = (Contract) contractVector.elementAt(i);
}
<FORM METHOD="POST" ACTION="contract_reg_step2.jsp">
...
<INPUT TYPE="text" NAME="payment_method" VALUE= "<jsp:getProperty
name="contract" property="payment_method" />" SIZE=30 MAXLENGTH=40>
...
It's ok, it allows me to edit some fields ( <INPUT TYPE...) defined in
the html form.
This is the list of the editable fields : validity_start_date and
payment_method
When the user click on submit, the ACTION in the form call the next JSP
page.
<%@ page import="be.eTrust.trustedSeal.service.bean.*" %>
<%@ page import="java.util.*" %>
<jsp:useBean id ="contract" scope="session"
class="be.eTrust.trustedSeal.service.bean.Contract" />
<jsp:setProperty name="contract" property="*" />
<% out.println("contract_id : " + contract.contract_id + "<BR>"); %>
...
And there : I have no more value in the contract_id and in the
creation_date ?????!!!!!!
I think it's because the setProperty get only the variables defined in
the form
But I thought that by defining the scope of the bean in session, this
would keep the values of the contract_id and the creation_date.
??
Can you explain me what it occurs exactly ??? and how can I keep the
informations (contract_id and creation_date) ??
Thanks you !!!!
Thierry
PS I can send you my code if you want....
===========================================================================
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