tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karr, David" <David.K...@wamu.net>
Subject RE: JSTL and EL with constants
Date Wed, 07 May 2003 21:47:06 GMT
I've never done this, but I've mentioned the possibility of writing a
class which introspected another class to obtain all the "static final"
variables and created entries in a map for each variable and value.
I've noticed that some people have said they've done something like
that.

> -----Original Message-----
> From: Jim Kennedy [mailto:jimk@gigaheads.com]
> 
> My issue is concerned with the use of constants to store items like
> session and request keys.  For almost all of my projects I define a
> Constants or Const class that will contain all global constants for
the
> application.  I think this is a good practice because it creates a
binding
> contract between the servlet and jsp for the use of session, request
keys
> and URL keys.  I believe many developers do this.  The values of these
> constants are usually meaningless.  So...
> 
> class Const
> 
> defines:
> 
> public static String ACTION = "xkxkdhfh11";
> public static String SORT = "sortxya";
> 
> 
> in my servlet I do:
> 
> // set thaction somewhere
> session.setAttribute(Const.Action, theaction);
> 
> in my JSP I could do:
> 
> <%
> String action = session.getAttribute(Const.Action);
> %>
> 
> but if I want to use the EL, it would look like
> 
> <c:set var="action" value="${xkxkdhfh11}" />
> 
> With the EL, it's the key's value that's important.  Same issue exists
for
> <jsp:useBean .../> and others.  I've done a bit of reading and if I
want
> to use my Constants, then I can not use the EL.  I would use the RT
libs.
> 
> What I want is to eliminate scriplets and expresssion completely from
my
> JSPs.  Anyone have any bright ideas.
> 
> Jim Kennedy
> IT Consultant
> Mobile Phone: 813-503-1484
> -----------------------------------------------------
> 


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


Mime
View raw message