12 May 2005 - java_dev (original) (raw)

Java developers

May 12th, 2005

| | 02:59 pm - swmichele - Need some advice with handling sessions. The situation is following - i have a very simple web-application, under Jakarta Tomcat. Basically, it's just few JSPs, few servlets and couple more classes. I'm trying to use three tier architecture and try to divide presentation part (jsp) from business logic (servlets + java beans). In general everything works ok, but what my problems is - sessions handling. Right now, i use "include top.jsp" on every page, and top.jsp contains something like:<% User user = (User)session.getAttribute("user"); if (user == null || !user.isAuthenticated()) { // here is redirect to login page } %>But as I see it - this is also considered business logic part. What i really want - try to get rid of such kind of code and make sevlets part hadle it. I know it's gonna work slower, but then business logic would be trully separated. How can i check if user is authenticated on every page without writing any business logic code in jsp? Or is it just not worth it and i should keep like this? | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

04:57 pm - theycallmesir - log4j Anyone have experience with Apache's log4j?I just downloaded it today and started playing around. I can get the BasicConfigurator working easy enough, now I'm trying to use the PropertyConfigurator to customiz the logs. The documentation says to put the log4j.properties file in the WEB-INF/classes dir. Which I did, and in the code I'm calling it like this...PropertyConfigurator.configure("/classes/log4j.properties");But when I run, it gives an log4j error, ERROR Could not read configuration file [/classes/log4j.properties]then throws a file not found exception, then another log4j error, ERROR Ignoring configuration file [/classes/log4j.properties].But here's the odd part, any changes I make to log4j.properties still come up.Any idea why I'm getting the errors?thanks