Re: Newbie: Session variable problem
David LeBer <[email protected]>
| Newsgroups | gmane.comp.web.webobjects.devel |
|---|---|
| Message-ID | <[email protected]> |
On 28-Oct-06, at 10:29 AM, PaulM wrote:
>
> Could someone please help me solve this session variable problem.
> If I use this line of code everything works as desired.
> "nextPage.donationDisplayGroup.setCurrentBatchIndex(3);"
>
> When I try the same line replacing the "3" with "sess.dBatch()" it
> doesn't
> work. Gives error "can't resolve symbol"
>
> What is the correct way to right these two lines...?
>
> Session sess = (Session)session();
> nextPage.donationDisplayGroup.setCurrentBatchIndex(sess.dBatch());
>
> A more complete code sample is shown below.
>
> Thank You.
>
> ------- In Session.java ---------------
>
> public class Session extends WOSession {
>
> < bunch of code snipped out>
>
> public Integer dBatch ;
> public Integer dBatch() {return dBatch; }
> public void setDBatch(Integer newDBatch) { dBatch = newDBatch; }
>
> }
>
>
>
> -----Code from a separate web component trying to read variable
> "dBatch"
> from session----
>
> public SearchDonations doList()
> {
> SearchDonations nextPage =
> (SearchDonations)pageWithName("SearchDonations");
>
> nextPage.donationDisplayGroup.qualifyDataSource();
>
>
> /* this next line works ---
> nextPage.donationDisplayGroup.setCurrentBatchIndex( 3 );
> the correct batch of the displaygroup is shown on the next page
> */
>
> Session sess = (Session)session();
> // this line does not work --
> // The code won't compile. Gives error can't resolve symbol
> nextPage.donationDisplayGroup.setCurrentBatchIndex(sess.dBatch());
> return nextPage;
> }
setCurrentBatchIndex takes an int not an Integer.
Try: setCurrentBatchIndex(sess.dBatch().intValue());
--
;david
--
David LeBer
Codeferous Software
'co-def-er-ous' adj. Literally 'code-bearing'
site: http://www.codeferous.com
blog: http://david.codeferous.com
--
Toronto Area Cocoa / WebObjects developers group:
http://www.tacow.org
_______________________________________________
WebObjects-dev mailing list
[email protected]
http://www.omnigroup.com/mailman/listinfo/webobjects-dev
smime.p7s
(application/pkcs7-signature, 2.3 KB) - not displayed