Paul,
  actually I don't re-reference it. I use it as it comes from the
<jsp:usebean ../> tag.
What I am wondering is how the sendRedirect works. Does it throws an
exception? that 'could' explain why I loose all the changes I do to my bean.
Otherwise what happens?

> -----Original Message-----
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Matthews,Paul
> Sent: 20 June 2000 11:28
> 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

Reply via email to