开发者

how to populate drop down with prepare interface

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜