Announcement Announcement Module
Collapse
No announcement yet.
Spring+AspectJ AOP config with JSP Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring+AspectJ AOP config with JSP

    I have configured AspectJ in my spring application. Since my app is a legacy app which is using JSP scriptlet code for server side processing.

    The problem I am facing is that I want to invoke an @AfterThrowing Advice when an Exception occurs in the JSP scriptlet code.

    My Advice method signature as of now is:

    Code:
    @Aspect**public*class*NotificationAdvice*{********
                @AfterThrowing(pointcut*=*"execution(**com.app.OtherBeanIntf.doSomething(..))",*throwing*=*"error")******
                 public*void*logAfterThrowing(JoinPoint*joinPoint,*Throwable*error)*{*
    In the above code, OtherBeanIntf is another Java bean which is working fine with this logging advice. Now how do I configure this advice to work with JSP scriptlet code too?

  • #2
    Hi extremejava,

    The JSP will be converted into a servlet class (the class name of which is server-dependent; e.g. Tomcat and Websphere use their own ways to create a temporary class name), and thereafter compiled.

    A better solution for your case is to refactor the concerned code out into a java class, and 'advice' that class.


    - k
    ================================================== ===
    [SpringSource Certified Spring Professional (Spring Certification) – Practice Tests]

    Comment

    Working...
    X