开发者

how to populate drop down with prepare interface

开发者 https://www.devze.com 2023-03-12 22:50 出处:网络
i saw a link struts2 drop down but i am unable to understand how to use prepare interceptor. how will request be forwarded to jsp and view method will be called

i saw a link struts2 drop down but i am unable to understand how to use prepare interceptor. how will request be forwarded to jsp and view method will be called

can anyone give me a example?

  public class YourAction extends ActionSupport {

public String prepare(){
     // populate your开发者_C百科 drop down object
}   

public String view(){
     // forward to your jsp
     return SUCCESS;
}

 }


Interceptors are invoked before and/or after the execution of action depending on the interceptor type.In your case the prepare interceptor is used. To understand the workflow of the interceptors in general take a look here

Regarding the prepare interceptors you should read this article before using it.


Try to use method name prepareView() instead of prepare().

As, prepare() will be called before any method in this class and prepareView() will be called only before view().

0

精彩评论

暂无评论...
验证码 换一张
取 消