I need to use Interceptor to change a value of Action. For example, below is
my intercept method.

public String intercept(ActionInvocation invocation) throws Exception {
       String result;

       result = invocation.invoke();

       MyAction action = (MyAction)invocation.getAction();
       User user = action.getUser();
       user.setName("name2");
       action.setUser(user);

       return result;
}

here is my Action class:

public class MyAction extends ActionSupport {
   private User user;
   public MyAction() {
       user = new User();
   }
   public String execute() throws Exception {
       user.setName("name1");
   }
   public User getUser() {
       return user;
   }
   public void setUser(User user) {
       this.user = user;
   }
}

In the jsp page, I use <c:property value="user.name"/> to display the user's
name, but it always display "name1". Why the interceptor cannot change the
value after invode invocation.invoke() method?

Thanks

--
Regards,
Fanbin

Reply via email to