Well I plan on upsetting everyone not just C programmers :-).
The CSpValue cast is unnecessary. You should think about casts because they
can be dangerous:
CSpider.putUserSessionObject("sesLetter",(CSpValue) new
CSpString("NULL"));
Would be better written as:
CSpider.putUserSessionObject("sesLetter", new CSpString("NULL"));
NULL and Space " " are both bad because they are repeated literal constants
which can not be checked by the compiler.
NULL is bad as an application level concept because it has many meanings,
like not yet set, not included, unknown, not applicable etc.
A static final String called NOT_SPECIFIED_BY_USER would be clear.
I quite like the bean approach as it hides the communication mechanism, but
what object do you want to put the methods in Joel?
As they are written they could be static and anywhere.
>From an implementation point of view there is no need to involve the session
engine. These values will now be hanging around in the persistence engine
for not particular purpose till the session ends. These values could just
as easily go in a query parameters object which could be a page instance
variable or even better just an argument to a new load function in the
target page.
Here is place a web hit object which lasts for this web event could be
useful. I know that people love the session stuff because it is simple, but
I just hate global variables.
As to the original problem, I suggest looking at the log for the SQL. See
what is happening and why some criteria are not being set. Add some debug
to find out exactly which lines are being hit.
Brendan Johnston
TeamND
-----Original Message-----
From: Joel Parker Henderson [SMTP:[EMAIL PROTECTED]]
Sent: Friday, May 21, 1999 7:54 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [ND] Java gurus please...
(Warning, Java style hints ahead. This email could upset C
programmers :-)
You wrote:
CSpider.putUserSessionObject("sesLetter",(CSpValue) new
CSpString("NULL"));
Hi, one quick piece of advice not related to your question:
the line above is written in a way that may confuse people,
because these are all different:
"NULL" NULL CSpString("NULL") (CSpString)NULL
(CSpValue)(CSpString("NULL");
Instead of "NULL", how about using a space letter?
CSpider.putUserSessionObject("sesLetter",(CSpValue) new
CSpString(" "));
If you want to prepare for Java Beans (which is always smart)
you may want to consider writing the above in a better, clearer
way that will be more understandable and encapsulated:
protected final string kSesLetter="sesLetter";
public void setSesLetter (char c) {
CSpider.putUserSessionObject(kSesLetter,(CSpValue) new
CSpString(c));
}
public void setSesLetterNull () {
CSpider.putUserSessionObject(kSesLetter,(CSpValue) new CSpString('
'));
}
public char getSesLetter () {
return (CSpider.getUserSessionObject(kSesLetter)).toChar();
}
public boolean isSesLetterNull () {
return (CSpider.getUserSessionObject(kSesLetter)).toChar()==' ';
}
The Bean style is preferable because now your developers
don't need to know your internal representation of NULL,
nor about ND sessions, nor about CSpValue or CSpString,
nor about what string you choose to use for "sesLetter".
The Bean approach takes a little more time and design.
In my experience, it is well worth it if you will ever
have other Java developers maintaining your code.
- Joel
[EMAIL PROTECTED]
_________________________________________________________________________
For help in using, subscribing, and unsubscribing to the discussion
forums, please go to:
http://www.netdynamics.com/support/visitdevfor.html
For dire need help, email: [EMAIL PROTECTED]
_________________________________________________________________________
For help in using, subscribing, and unsubscribing to the discussion
forums, please go to: http://www.netdynamics.com/support/visitdevfor.html
For dire need help, email: [EMAIL PROTECTED]