Doesn't this question highlight the importance of supporting at least one
scripting language for scriptlets? (I'm not counting Java as a scripting
language.) It seems to me that at least some users of JSP should not have
to understand the distinction between reference equality and content
equality, which is often a sticking point for Java newbies (especially with
strings).
You could almost say that a scripting language must, at the least, have a
built-in string type, a simple infix operator for concatenation, and an
infix comparison operator (== or its equivalent) which, when applied to the
string type, does character-by-character matching. I think that holds true
for the big four - Python, JavaScript, TCL, and Perl.
What plans are there to allow scripting languages in the next JSP spec?
Will the vendors be able to decide which languages they support (given that
they must support Java at a minimum)?
I realize that there may be some difficult issues involved in updating the
spec to provide for other languages. However, Python (via JPython) and
JavaScript don't seem like they would be too tough to implement, given the
hooks to Java they already have.
Or is the intent that the custom tags will remove any need to support
scripting languages? It looks like, in that case, there will still be
problems like this one, and probably other yet-undiscovered ones as well.
Some freedom in choice of language might make it easier to leverage
everybody's skills, and remove another possible managerial objection to
using JSP. ("Waddaya mean, my web designer has to learn Java!? She
already knows JavaScript ... maybe we should be using ASP instead.")
Steve Odendahl
Vunetix, Inc.
At 09:30 AM 8/27/99 -0700, Craig R. McClanahan wrote:
>Chris Mcgarel wrote:
>
>> Can someone expalin to a novice why I must use:
>> if (Request.Form("myFormElement").equals("myString"))
>> rather than a straight comparison operator:
>> if (Request.Form("myFormElement")=="myString")
>> ?
>>
>> The latter does not work for me even though both left and right sides of
the
>> statement are Strings.
>>
>
>It never will work, either, if your intent is to see if the string
contents are
>identical. Strings are objects, not native data types. When you use the
"=="
>operator on objects in Java, you are comparing the object references for
equality,
>not the object contents. That's why you need to use the equals() function to
>accomplish what you want.
>
>Given:
>
> String a = "abc";
> String b = "abc";
>
> if (a == b) {
> System.out.println("Got a == b");
> } else {
> System.out.println("Got a != b");
> }
> if (a.equals(b)) {
> System.out.println("Got a equals b");
> } else {
> System.out.println("Got a notequals b");
> }
>
>will print
>
> Got a != b
> Got a equals b
>
>The same principle applies to other object types besides Strings -- the
equals()
>method is used to compare the contents of two objects for equality, while
the ==
>operator compares the two pointers to those objects.
>
>Craig McClanahan
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
>FAQs on JSP can be found at:
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html