What... Sorry the example is miss leading.
The ureg.create() does Not instanciate anothe object it does something on
the database. I guess a better sample is
<jsp:useBean id="ureg" class="com.emsuk.UserRegistration" scope="session"
/>
<%
if (ureg.createInDB()) {
ureg.setFormCurrent("");
response.sendRedirect("Succesful.html");
else {
...
}
%>
> -----Original Message-----
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Lee Elenbaas
> Sent: 20 June 2000 12:00
> To: [EMAIL PROTECTED]
> Subject: Re: sendRedirect problem, loosing bean changes!?
>
>
> in your example you create a second instance to the bean but never save in
> in the session, i always let the JSP generate the instances for
> me, this way
> i don't have to keep track on them (except for beans of an
> interface type).
>
> lee
> Lee Elenbaas
> ViryaNet
> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
> http://www.viryanet.com/
>
>
> -----Original Message-----
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Matthews,Paul
> Sent: Tuesday, June 20, 2000 1:28 PM
> To: [EMAIL PROTECTED]
> Subject: Re: sendRedirect problem, loosing bean changes!?
>
>
> Even if the scope is 'session' you will get that behaviour if you do
> something like...
>
> <jsp:useBean id="myBean1" scope="session" class="blah.myBean"/>
>
> ..
>
> myBean1.setValue(200);
> myBean1 = someBean.getMyBean();
> myBean1.setValue(100);
>
> // value is now 100
>
> after the forward however, 'value' will be 200. Not looked at the compiled
> JSP but would guess that the reference is being stored in the session at
> instantiation. To get around it use some sort of copy method- ie
>
> myBean1.copy(someBean.getMyBean());
>
> Probably a better (proper?) way to do this.
>
> Paul
>
>
>
>
>
> > -----Original Message-----
> > From: Lee Elenbaas [mailto:[EMAIL PROTECTED]]
> > Sent: 20 June 2000 10:56
> > To: [EMAIL PROTECTED]
> > Subject: Re: sendRedirect problem, loosing bean changes!?
> >
> >
> > make shore that your bean has the scope of session, this way
> > it will be kept
> > between requests.
> > lee
> > Lee Elenbaas
> > ViryaNet
> > [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
> > http://www.viryanet.com/
> >
> >
> > -----Original Message-----
> > From: A mailing list about Java Server Pages specification
> > and reference
> > [mailto:[EMAIL PROTECTED]]On Behalf Of Mauro Gagni (EMS)
> > Sent: Tuesday, June 20, 2000 12:11 PM
> > To: [EMAIL PROTECTED]
> > Subject: sendRedirect problem, loosing bean changes!?
> >
> >
> > Hi all,
> > I am having some troubles maintaining the changes of my bean
> > done before a
> > response.sendRedirect(). What happens is this:
> > I have an if statement where I change a few parameters of my
> > session bean
> > i.e. mybean.setMyProperty("newValue") bean and then I
> > sendRedirect() to the
> > page I want. It apparently works fine because I get the page
> > I request with
> > the redirection, but my bean has lost the change in the
> > property so if I do
> > a .getMyProperty() I get "oldValue" and not what I expected
> > ("newValue").
> >
> > Is this 'normal' or there is something that I am missing?
> > please help me in undestanding what happens.
> >
> >
> > TIA, mauro
> >
> > the sample code in my JSP page
> >
> > <jsp:useBean id="ureg" class="com.emsuk.UserRegistration"
> > scope="session" />
> >
> > <%
> > if (ureg.create()) {
> > ureg.setFormCurrent("");
> > response.sendRedirect("Succesful.html");
> > else {
> >
> > ...
> > }
> > %>
>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
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