You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by John Baker <jb...@teamenergy.com> on 2002/03/19 10:18:15 UTC

Static constants

Apologies if I've sent this already, but I didn't get a mail back so I'm 
assuming it never got there ;-)

----------  Forwarded Message  ----------

Subject: Re: My last annoying question of the day, promise.:-)
Date: Mon, 18 Mar 2002 20:29:02 +0000
From: John Baker <jb...@teamenergy.com>
To: "Tag Libraries Users List" <ta...@jakarta.apache.org>

On Monday 18 Mar 2002 18:41 pm, you wrote:
> Just don't...  ;-)
>
> Good Java style dictates that you keep everything as private as possible,
> certainly class variables and then use methods to get and set them, like
> getY and setY.

Yes, I understand good Java style (having done it for so long), however
public static variables are common place and useful. I wouldn't ever want to
provide get methods for these as it's clearly evil ;-)

For example, I have a servlet that takes two parameters, A and B. I don't
want to do:

moo?a=Whatever&b=whatever,

as I might, one day, want to change the names of the parameters of A and B.
Therefore I use public statics in the servlet to store the names of these
attributes. Ie:

moo?<%= MyServlet.A %>=Whatever

*much* nicer when you're writing generic components.

However it looks like I have no choice :(

That's a real minus point for JSTL.


John

--
John Baker, BSc CS.
Java Developer, TEAM Slb. (http://www.teamenergy.com/)
The views expressed in this mail are my own.

-------------------------------------------------------

-- 
John Baker, BSc CS.
Java Developer, TEAM Slb. (http://www.teamenergy.com/)
The views expressed in this mail are my own.

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>