You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Laurent <lg...@free.fr> on 2005/02/11 11:53:30 UTC

Re: Constants for property names

Daffin, Miles (Company IT) wrote:
> What do people feel about using constants for property names?
>  
> In general I feel one should use constants for such things, but it is
> far from easy in a web app to do so.

I can't really see the point. A property name is like a variable name, 
it will never be displayed or localized, so why would you ever want to 
change it?


> <html:text property="<%=Keys.Section0.APPLICANT_NAME%>"/>

Can you think of a case where this value won't be "applicantName"?


> - jstl tags
> - xml files (e.g. struts-config, validation)

Worse: if you have an ActionForm, you can't have a property whose name 
depends on a constant!! And what about getters and setters.


> Should I forget about defining
> constants?

Yes :)


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org