0 Replies Latest reply on May 19, 2009 6:12 AM by Alen Ribic

    Example in JSP expression language and JSP scriptlets, diffe

    Alen Ribic Newbie

      I have a Servlet that sets an Action Bean instance as an attribute called 'actionBean'.
      I also have successfully setup an AOP interceptor (with load time weaving) to intercept the User bean's getName() method.

      class User {
       private String name;
       // getters/setters
      class ActionBean {
       private User user;
       // getters/setters + other action methods
      class MyServlet extends HttpServlet {
       public service(HttpServletRequest req, HttpServletRequest resp) {
       User user = new User();
       ActionBean actionBean = new ActionBean();
       request.setAttribute("actionBean", actionBean);

      In the JSP context I try the following JSP scriptlet:
       ActionBean actionBean = (ActionBean)request.getAttribute("actionBean");
       User user = actionBean.getUser();
       out.print("user: " + user.getName());

      And the call works 100% with the AOP interceptor being called.

      However, I try the same with JSP expression language:

      And the calls works BUT the AOP interceptor does not get called.

      Somehow it seems that the JSP expression language and JSP scriptlets get evaluated differently and as a consequence my AOP interceptor does not get called.

      Any help would be greatly appreciated.