Archive for October, 2004

Monitoring Performance in the Windows world.

Friday, October 22nd, 2004

Are all the database connections in this application being closed when they should be? This is a question I asked myself today and it reminded me of a Windows XP feature I learned about in class a few years ago. If you go to Windows’ “Administrative Tools”, which can be accessed through the “Control Panel”, there is an application titled “Performance”. Double-clicking on this application opens a window with a real time graph. If you click on the “+” icon above the graph you’ll get another window with a drop-down that allows you to select from a long list of performance counter categories. I selected the “SQLServer: General Statistics” category and then was given the opportunity to add “Logins/sec”, “Logouts/sec” and “User Connections” to the graph. After selecting “User Connections” I was able to see that the application I was working with was not implicitly closing all database connections that it was opening.

As I mentioned, there is a long list of performance counter categories to select from, including “Web Service” which can be useful if you’re working with IIS. If you’re developing in .NET you can even create your own custom performance counters, for instance you might want to create a “Number of people named Bob that log-in to your website” performance counter.

Using the Expression Language in your custom tags

Wednesday, October 6th, 2004

JSTL is great for eliminating scriptlets in your JSPs. The standard JSTL tags are designed to be general purpose, applicable and useful in many different applications. But frequently you need to create your own custom tags to meet the needs of your specifc application. To really take advantage of the JSTL you need to make your custom tags work in conjuction with the JSTL. For instance, you may want to use the ‘forEach’ tag provided by the JSTL and have your custom tag nested inside the forEach loop. Inside the loop you want to have your tag interact with the variable that is exposed by the ‘var’ attribute of the forEach tag. You can accomplish this by giving your custom tag the ability to evaluate expressions written in the JSTL’s expression language.

If you are working with JSP 2.0, the expression language is part of the servlet specification and you can find the classes for evaluating expressions in the javax.servlet.jsp.el package.

If you haven’t stepped up to JSP 2.0 yet and you’re working with JSTL 1.0 you can use the org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager class found in the Jakarta taglibs standard.jar file.