View Javadoc
1   package gboat2.base.view.jsp;
2   
3   import gboat2.base.view.components.Overlay;
4   
5   import javax.servlet.http.HttpServletRequest;
6   import javax.servlet.http.HttpServletResponse;
7   
8   import org.apache.struts2.components.Component;
9   import org.apache.struts2.views.jsp.ComponentTagSupport;
10  
11  import com.opensymphony.xwork2.util.ValueStack;
12  
13  /**
14   * 覆盖继承的 JSP 页面中的代码块
15   * 
16   * @author <a href="mailto:[email protected]">何明旺</a>
17   * @since 3.0
18   * @date 2014年4月22日
19   */
20  public class OverlayTag extends ComponentTagSupport {
21      
22      private static final long serialVersionUID = 1L;
23  
24      /** 要覆盖的代码块的唯一标识,即与父页面中 block 标签的 id 值保持一致 */
25      protected String id;
26      
27      @Override
28      public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
29          return new Overlay(stack, req);
30      }
31  
32      @Override
33      protected void populateParams() {
34          super.populateParams();
35          ((Overlay)component).setId(id);
36      }
37  
38      public void setId(String id) {
39          this.id = id;
40      }
41  
42  }