"Denise Mangano" <[EMAIL PROTECTED]> wrote in message
5D83C44941AFD4118B6F0002B302984F438636@EXCHANGE_SERVER">news:5D83C44941AFD4118B6F0002B302984F438636@EXCHANGE_SERVER...
> Wow someone read all of that!! ;)
>
> For Question #1:  I should have mentioned this before... I tried to use
> session scope at one point (don't recall the exact reason but I thought of
> it as an attempt to resolve a different problem).  When I set the scope to
> session, it caused problems with my form validation.  Currently if the
form
> is not validated, the user is brought back to Retry.jsp and error messages
> appear next to the offending input field.  When I used session scope,
> Retry.jsp would be reloaded, but the error messages would not be
> displayed... Any thoughts on that?  I am going to go back and attempt this
> again now that everything is working as it should up to Verify.jsp and see
> if I stand corrected...

You need:
<jsp:useBean id="transaction" class = "com.complusdata.beans.Transaction"
scope="session" />
  <jsp:setProperty name="transaction" property="email"
value="<%=formHandler.getEmail()%>"/>
....


Note the final '/>' on jsp:useBean.  The way that you had it originally, the
properties will only be set if the JSP page needs to create a new instance
of "transaction".  If it finds one in the session already, the setters are
skipped.



>
> For Question #2 - that's exactly what I needed to know!!
>
> For Question #3 - hopefully I can get the session scope to work, but then
> how would I program that button?  Would I just put onClick="Retry.jsp" ?
>
> Tim, thank you so much for taking the time!!
> Denise :)
>
> -----Original Message-----
> From: Tim Moore [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, January 07, 2003 9:24 PM
> To: Tomcat Users List
> Subject: RE: Java Bean Scope questions (a lengthy one)
>
>
> > -----Original Message-----
> > From: Denise Mangano [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, January 07, 2003 9:19 PM
> > To: 'Tomcat Users List'
> > Subject: Java Bean Scope questions (a lengthy one)
> >
> >
> > Question #1: Why does CCSubmit.jsp not have access to
> > formBean properties. I am thinking this is because
> > technically by submitting a form with an action of
> > "CCSubmit.jsp" control isn't being forwarded to CCSubmit.jsp
> > so the instance of formBean isn't forwarded.  The scope of
> > formBean is request. Is that the correct scope to use?  **I
> > need to have access to formBean properties from the moment it
> > is instantiated to the moment the application
> > has completed, but it has to be unique to each user of the
> > webapp.**   How
> > could I accomplish this?
>
> That's exactly what session scope is for. :-) Request scope means that the
> bean is gone at the end of the request (that is, when Verify.jsp finishes
> rendering).  If you put it in session scope you'll be set.
>
> > Question #2: Is it possible to use two beans within a single
> > jsp page?  I would imagine that it is, and if so I believe
> > once I gain access to formBean properties, my transaction
> > properties will no longer be null. (I included some code
> > below... is this legal?)
>
> Absolutely!  As long as they have different id attributes, you can use as
> many beans as you like.
>
> > Question #3:  I include a button to give the option to go
> > back and make changes.  If the user should desire to go back
> > and make changes, control should be forwarded to Retry.jsp on
> > button click.  I need to program this button in a way so that
> > when Retry.jsp is recalled it will still have access to
> > formBean properties.How do I program this? My last attempt
> > using <jsp:forward> cause Retry.jsp to load automatically
> > when Verify.jsp was loaded (sorry again Noel ;) ).
>
> As long as the bean is in session scope, you'll be able to access it from
> any page the user accesses.
> --
> Tim Moore / Blackboard Inc. / Software Engineer
> 1899 L Street, NW / 5th Floor / Washington, DC 20036
> Phone 202-463-4860 ext. 258 / Fax 202-463-4863
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>




--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to