Re: Newbie: Session variable problem
"Jerry W. Walker" <[email protected]>
| Newsgroups | gmane.comp.web.webobjects.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi, Paul,
The method signature for setCurrentBatchIndex() is:
public void setCurrentBatchIndex(int batchIndex)
Notice that the method parameter is declared as an int.
The method signature for your dBatch method is:
public Integer dBatch()
In other words, it returns and Integer object rather than an int
primitive. So Java looks for a setCurrentBatchIndex() method
signature that takes an Integer object as its parameter and finds
none, therefore... "can't resolve symbol"!
To avoid the problem, change your faulty line of code to:
nextPage.donationDisplayGroup.setCurrentBatchIndex(sess.dBatch
().intValue());
You might have been helped in finding this solution by looking in
Xcode's build results window. When you see a message in Xcode's
status bar at the very bottom of the Xcode window indicating build
errors, you can click on that message and Xcode will display the
build results window.
To understand all the information contained therein, take a look at
this page:
http://developer.apple.com/documentation/DeveloperTools/Conceptual/
XcodeUserGuide/Contents/Resources/en.lproj/05_07_bs_building_product/
chapter_34_section_4.html
In particular, note that if the Build log pane is open and you click
on a line in the Build results pane of the Build Results window, the
Build log pane will scroll directly to the lines in the build log
indicating details about the error. In your case, it would have shown
you which variable was unresolved, indicating that it was having
trouble with "setCurrentBatchIndex()".
Knowing this, the first thing I would think of is method signature.
Well, actually, the first thing I would think of is whether I have
the appropriate imports, which tends to be a more common error on my
part, but method signature rates right up there among the the early
thoughts that hit my head while resolving such compilation errors.
Regards,
Jerry
On Oct 28, 2006, 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;
> }
>
> -------------------------------------------
> --
> View this message in context: http://www.nabble.com/Newbie%3A-
> Session-variable-problem-tf2529717.html#a7050072
> Sent from the WebObjects-Dev mailing list archive at Nabble.com.
>
> _______________________________________________
> WebObjects-dev mailing list
> [email protected]
> http://www.omnigroup.com/mailman/listinfo/webobjects-dev
--
__ Jerry W. Walker,
WebObjects Developer/Instructor for High Performance Industrial
Strength Internet Enabled Systems
[email protected]
203 278-4085 office