[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] AspectJ, Annotations and JSP

I know this is a Non-Aspect solution, but what about just using JSP Includes to accomplish this?

On 5/12/06, Scott < aspectj-users@xxxxxxxxxxx> wrote:
I have a bunch of JSPs that all have common init methods.


public void jspInit() {


I could put this at the top of each JSP. But that got me wondering if there was a better way to do this with AspectJ. In the past I have used and loved @AspectJ annotated style. I have also used annotations on classes and methods to make pattern matching a lot easier. I would like to do that here too. If I could annotate the JSP class, I could add the jspInit() method to all JSPs with the annotation. Wallah!

Of course, there is a problem. The JSP is run through the JSP compiler. So there appears to be no way to put an annotation on the resulting JSP class. If there is a way to annotate a JSP class, I don't know how. Assuming I still want to use annotations I would have to do this:


public void jspInit() {}


This does not get me much. I still have to write the method. I could fall back to regular pattern matching without the annotation within the @Pointcut. But This could potentially get really complex since I have JSPs all over the place. And some JSPs need this while others do not.

Any ideas?

aspectj-users mailing list