1    package com.instantbank.servicing.control.util;
2    
3    import java.util.StringTokenizer;
4    
5    import javax.servlet.http.HttpServletRequest;
6    import javax.servlet.http.HttpServletResponse;
7    import javax.servlet.ServletContext;
8    import javax.servlet.http.HttpSession;
9    import javax.servlet.ServletException;
10   
11   import com.instantbank.servicing.control.util.WebKeys;
12   import com.instantbank.common.utilcomponents.Debug;
13   
14   /**
15    *  This utility class for web tier components (namely Java Server Pages and
16    *  JavaBeans). This class provides a central location to do specialized
17    *  formatting in both a default and a locale specific manner.
18    *
19    * @author Instant-bank (Consuelo Franky)
20    * @created September 2002
21    */
22   public final class JSPUtil extends Object {
23   
24     //access to eventCounter is only through the
25     //accessor method getEventId() :
26   
27     private static int eventCounter;
28   
29   
30     /**
31      *  genera secuenciador unico
32      *
33      * @return The eventId value
34      */
35     public static int getEventId() {
36       return eventCounter++;
37     }
38   
39   
40     /**
41      *  method for putting in the current request, the message and the stacktrace
42      *  of an exception previously catched
43      *
44      * @param request current request
45      * @param problem String with the format: messageString|stackTraceString
46      */
47     public static void putProblemInRequest
48       (HttpServletRequest request, String problem) {
49   
50       StringTokenizer problemTokens = new StringTokenizer(problem, "|");
51       String theProblem = problemTokens.nextToken();
52       String theStackTrace = problemTokens.nextToken();
53       request.setAttribute(WebKeys.ExceptionOcurred, theProblem);
54       request.setAttribute(WebKeys.ExceptionStackTrace, theStackTrace);
55     }
56   
57   }
58   
59