Thanks Hans & Hamid for your help,
I have found a very simple solution to this:
By placing <jsp:setProperty> tags within the body of the use
<jsp:useBean>, the set property was only executing when the bean was
instantiated (which was the problem, as when a user went back to change
the form or created a new project the beans values were not overwritten)
By placing the <jsp:setProperty> tags outside the <jsp:useBean>, means
that even if an initialized bean exist the form values are over written:
<jsp:useBean id="proj" scope="session"class="projects.ProjTeamNew"/>
<jsp:setProperty name="projTeamBean" property="*"/>
Thanks for your help.
-----Original Message-----
From: Hamid [mailto:[EMAIL PROTECTED]]
Sent: 09 August 2001 06:16
To: [EMAIL PROTECTED]
Subject: Re: Re- initialising a Bean
Hi,
1) Define hidden var for each one upto last/requirement page like:
<input
type=Hidden name=abc value=<%field-value%>
2) Define var in bean as static and initialize them at the last page.
3) Define session variables and destroy at the last page.
Hamid Hassan
Software Engineer
Visualsoft Pvt. Ltd.
-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Mohammad Ramzan
Sent: Wednesday, August 08, 2001 9:21 PM
To: [EMAIL PROTECTED]
Subject: Re- initialising a Bean
Hello,
I am having trouble,
The scenario is:
To create a new project a user has to fill out three forms in sequence.
For each form I am storing the form values in separate beans using
jsp:setProperty, the beans have session scope.
I can then submit these variables into the database once the user
reaches the last stage.
The problem:
This works fine but when the user goes to create another new project the
form values in the beans are not be overwritten, this is because of the
session scope.
The question:
How can I re-initialise a bean for every request but still give it
session scope so I can submit the values to the DB, two pages later?
I have been going round in circles on this one, any help is much
appreciated.
Thanks, Mo
=========================
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=P
http://www.jguru.com/jguru/faq/faqpage.jsp?name=rvlets
========================================================================
===
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