> A recent thread out here has me playing with the "scope" attribute of the
> <jsp:useBean> tag. Unfortunately, I have hit a wall. When using a bean of
> scope="session", which is populated from an HTML form using a
> <jsp:setProperty name="foo" property="*"/>. The initial population of the
> bean is OK, however when I hit "back" on the browser to make corrections
to
> the form data, subsequent updates of the beans information are not
> successful. This is alleviated by using a bean of scope="request", however
> that is not what I need. Anyone encounter this problem and have a
> solution???
I solved the problem "resetting" the bean.
Instead of the useBean tag, i use:
myBeanClass bean = new myBeanClass();
session.setAttribute("id bean istance", bean)
So each time u acces to this page, the bean is resetted to the deafult
value.
After this, u'll have to put the setProperty * tag to initialize the bean
with the new values submitted.
P.S.: Remember that using the setProperty * feature, the corresponding set
methods are called only if the corresponding form field is not empty. I
mean, if u fill & submit the form, then u come back, delete a field and then
submit again, the field u deleted won't be set to a null value in the bean
but it will keep the old value. It's better to use manually the set property
methods: bean.setProperty1("value") for each fields of the form.
===========================================================================
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