Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] AspectJ with servlets

Hi all,

I'm quite new to AOP and have a quiestion about using AspectJ to modularize
crosscutting properties in servlets. It would be helpful to find a solution
for this problem:

I have a servlet wich gets a parameter from a jsp (form) and forwards it to
an other....   

...
 protected void processRequest(HttpServletRequest request,
HttpServletResponse response)
            throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();
        try {
        	String p = (String)request.getParameter("p");
        	request.setAttribute("p", p);
            request.getRequestDispatcher("Index.jsp").forward(request,
response);   	
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
...

Now I would like to implement a new requirement : "count the carachters of
the string parameter and forward it to Index.jsp". How can I do it with
AspectJ? I have the idea (the execution of the getParameter have to be
cougth by a pointcut, and after:pointcut the aspect have to post this value
(length) to Index.jsp) but I haven't the syntax. Can please you help me?

Thanks,
Istvan

-- 
View this message in context: http://www.nabble.com/AspectJ-with-servlets-tp15039655p15039655.html
Sent from the AspectJ - users mailing list archive at Nabble.com.



Back to the top