tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jim Kennedy" <>
Subject JSTL and EL with constants
Date Wed, 07 May 2003 21:25:10 GMT
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. 

class Const


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

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