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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to