[Javascript] struts form using javascript code

Håkan Magnusson hakan at backbase.com
Thu Mar 4 04:44:49 CST 2004


Just a little add in here.
On of the powers of JavaScript is its object model, meaning that you can 
access properties of objects just like they were arrays.

myObject = new Object();
myObject.theProperty = true;

Both of these are perfectly legal:

if(myObject.theProperty == true)

if(myObject['theProperty'] == true)

I haven't followed the discussion since I'm not into struts forms, just 
adding my €0.02.

H

Chris Tifer wrote:
>>You're right. I've never run into that before, but it feels like
>>an implementation bug to me. An Array length of 1 *is* legal.
> 
> 
> Yes, that's true, but there is no array here. That's what I'm trying to get
> across. There is no collection (your array) of objects. There is only one.
> Once it becomes a collection you can reference it as though it were an
> array. But until then, it is just one instance.
> 
> I believe this has been the implementation for quite some time and haven't
> heard of them working on any changes to this.  All it means is you need to
> do a little more object-based checking to see how to handle it.
> 
> Chris Tifer
> 
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
> 
> 



More information about the Javascript mailing list