Servlet Connection Pooling for Dummies
By Geertjan on Apr 04, 2005
- After deploying, as described in the previous blog entry ("Super Cool Connection Pool"), right-click the index.jsp file and choose View Servlet.
- Select everything in the file and copy it.
- Create a servlet named index_jsp and put it in a package called org.apache.jsp. (Right-click the project node, choose New > Servlet.)
- Paste the code you copied over all the default code in the template.
- Right-click the Libraries node, choose Add Library, click Manage Libraries, click New Library, name it JASPER, click Add JAR/Folder, browse to enterprise1\\jakarta-tomcat-5.5.7\\common\\lib and select jasper-runtime.jar. Click OK.
Now deploy the servlet and you'll get the same result as below.
NB: There's one disadvantage with this and that is that the servlet is translated from the JSP file by the server. Therefore, the servlet created by the Sun Java System Application Server may not work with the Tomcat Web Server. Similarly, a servlet created by one version of a server may not work with another. Portability...
Update 04/25/05: Finding it hard to establish a connection from your Java source file to your database? Check out this blog entry: NetBeans IDE 4.1: No More Worrying About Database Connections.