title: Struts2 pass action's method result to custom tag
body: <p>I want to create simple dummy tag which can work with Struts2.</p>
  
  <p>I have an action:</p>
  
  <pre><code>class MyAction extends ActionSupport{
  
    /** 
      Some code
     */
    public Department getRoot(){
      /** Some code foes here...*/
      return departmentInstance;
    }
  }
  </code></pre>
  
  <p>a tag:</p>
  
  <pre><code>&lt;%@tag language="java" pageEncoding="UTF-8"  body-content="empty"  %&gt;
  &lt;%@ attribute name="tree" required="true"%&gt;
  &lt;%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="p"%&gt;
  &lt;p:defineObjects /&gt;
  &lt;%@tag import="ejb.model.Department"%&gt;&lt;%
   Object attrTree = pageContext.getAttribute("tree");
   System.out.println("TreeTagHelper-&gt;tree=["+attrTree+"]");
   if(attrTree!=null){
    System.out.println("TreeTagHelper-&gt;tree.class=["+attrTree.getClass().getName()+"]");
   }else{
    System.out.println("TreeTagHelper-&gt;tree.class=[NULL]");
   }
   try{
   //some code...
   }catch(Exception e){
    System.out.println("Error while drawing tree["+e.getMessage()+"]");
   }
  %&gt;
  </code></pre>
  
  <p>and my jsp with tag:</p>
  
  <p><code>&lt;%-- pass instance of Department  to tag --%&gt;</code>
   </p>
  
  <p>What do I have to do if I want to pass result of <code>MyAction#getRoot</code> to my dummy tag?</p>
  
  <p>I've tried to these:
  
  
  
  </p>
  
  <p>Nothing happens, in tag I get String with value <code>root</code> or get null. </p>
  
  <p>I can't pass an object to tag attribute.</p>
  
  <p>What do I do wrong?</p>