Hi Matt,

in struts.xml, i can see the order of interceptor references, like as
follows
...
<interceptor-ref name="prepare" />
<interceptor-ref name="params" />
...
in prepare method, my code is
public void prepare() {
          if(null != getRequest.getParameter("id")) {
                  Employee =
employeeManager.get(Long.parseLong(getRequest.getParameter("id"));
          }
}

if i change the order of interceptors to be called, such as follows.
<interceptor-ref name="params" />
<interceptor-ref name="prepare" />

First params interceptor is called and then prepare interceptor.

Then my code in prepare method would be simple,like as follows.

public void prepare() {
          if(null != id) {
                  Employee = employeeManager.get(id);
          }
}

because of params interceptor, setter methods fo request parameters are
called, and hence I am able to check for null of id.

Is this the Good approach to change the interceptors order in struts.xml ?

Thanks,
Dhana kumar Anem.

-- 
View this message in context: 
http://www.nabble.com/About-Struts-2-params-and-prepare-interceptors-tp24353771s2369p24353771.html
Sent from the AppFuse - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net

Reply via email to