You want to build and deploy a JSP that uses AspectJ into Apache Tomcat.
Create a Java Servlet from your JSP using the tools supplied with
Tomcat. Compile your Java Servlet from
the command line using the
ajc command or inside
an Eclipse AspectJ project.
Set up a directory structure from which to deploy your complete JSP
application, including the aspectjrt.jar support
library and the .class files that were compiled
ajc command-line tool.
Copy the deployment directory entirely to the %TOMCAT_INSTALL_DIRECTORY%/webapps directory. Make the appropriate amendments to the server.xml file in the Tomcat configuration to enable your web application. Finally, restart Tomcat to activate your web application.
Java Server Pages are trickier than Java Servlets when it comes to using a custom compiler such as AspectJ because a JSP is traditionally compiled into a Java Servlet transparently by the Servlet containers like Apache Tomcat.
The following steps describe how to build and deploy a simple JSP that uses AspectJ into Apache Tomcat:
Create a directory in your project area called jsp.
Create a file in the jsp directory called simple.jsp that has the following contents:
<html> <body bgcolor="white"> <h1> Request Information </h1> <font size="4"> JSP Request Method: <%= request.getMethod( ) %> <br> Request URI: <%= request.getRequestURI( ) %> <br> Request Protocol: <%= request.getProtocol( ) %> <br> Servlet path: <%= request.getServletPath( ...