struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jim Collins" <james.coll...@blueyonder.co.uk>
Subject Re: Accessing an ID property of a bean using EL
Date Wed, 23 Jul 2003 21:01:16 GMT
Adam,

>From the JavaBeans spec:

When we use design patterns to infer a property or event name, we need to decide what rules

to follow for capitalizing the inferred name. If we extract the name from the middle of a
normal

mixedCase style Java name then the name will, by default, begin with a capital letter.

Java programmers are accustomed to having normal identifiers start with lower case letters.

Vigorous reviewer input has convinced us that we should follow this same conventional rule

for property and event names.

Thus when we extract a property or event name from the middle of an existing Java name, we

normally convert the first character to lower case. However to support the occasional use
of all

upper-case names, we check if the first two characters of the name are both upper case and
if

so leave it alone. So for example,

"FooBah" becomes "fooBah"

"Z" becomes "z"

"URL" becomes "URL"

----- Original Message ----- 
From: "Jim Collins" <james.collins@blueyonder.co.uk>
To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
Sent: Wednesday, July 23, 2003 9:16 PM
Subject: Re: Accessing an ID property of a bean using EL


> Thanks Adam. I must have missed that variation of capitalisation.
> 
> Regards
> 
> Jim.
> ----- Original Message -----
> From: "Adam Levine" <adam_l_levine@hotmail.com>
> To: <struts-user@jakarta.apache.org>
> Sent: Wednesday, July 23, 2003 8:32 PM
> Subject: Re: Accessing an ID property of a bean using EL
> 
> 
> > It has to deal with the way Java resolves bean fields where there are
> > multiple uppercase in a row.  I believe if you used .ID in your jsp it
> > should work.   I always get confused on how the rules work in resolving,
> so
> > I attempt to use as few caps in a row as possible.. ie, ID -> id ->
> > getId/setId -> myClass.id
> >
> >
> > From: "Jim Collins" <james.collins@blueyonder.co.uk>
> > Reply-To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
> > To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
> > Subject: Accessing an ID property of a bean using EL
> > Date: Wed, 23 Jul 2003 20:23:17 +0100
> >
> > Hi,
> >
> > I have a bean with the following methods:
> >
> > public String getID();
> > public void setID(String id);
> >
> > I am trying to access the id property in a page like this:
> >
> > <html:link page="viewFile.do?id=${folderDets.iD}">...</html:link>
> >
> > Where folderDets is my bean. I have tried different combinations of ID
> > capitalisation but none seem to work. If however I change the property to
> :
> >
> > public String getDocID();
> > public void setDocID(String id);
> >
> > And access it like this:
> >
> > <html:link page="viewFile.do?id=${folderDets.docID}">...</html:link>
> >
> > It now works fine.
> >
> > Does anyone know why I can't have an ID property?
> >
> > Thanks
> >
> > Jim.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
> > _________________________________________________________________
> > The new MSN 8: smart spam protection and 2 months FREE*
> > http://join.msn.com/?page=features/junkmail
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message