struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From holod <serega.shey...@gmail.com>
Subject How to pass date from action to custom jsp tag?
Date Fri, 05 Nov 2010 19:17:11 GMT

Hello, I want to create simple dummy tag.
I have an action:

class MyAction extends ActionSupport{

  /** Some code*/
  public Department getRoot(){
    /** Some code foes here...*/
    return departmentInstance;
  }
}

a tag:
<%@tag language="java" pageEncoding="UTF-8"  body-content="empty"  %><%@
attribute name="tree" required="true"%><%@ taglib
uri="http://java.sun.com/portlet_2_0" prefix="p"%><p:defineObjects /><%@tag
import="ejb.model.Department"%><%
	Object attrTree = pageContext.getAttribute("tree");
	System.out.println("TreeTagHelper->tree=["+attrTree+"]");
	if(attrTree!=null){
	
System.out.println("TreeTagHelper->tree.class=["+attrTree.getClass().getName()+"]");
	}else{
		System.out.println("TreeTagHelper->tree.class=[!!NULL!!!]");
	}
	try{
	//some code...
	}catch(Exception e){
		System.out.println("Error while drawing tree["+e.getMessage()+"]");
	}
%>

and my jsp with tag:

<pext:drawTree tree="root"/>

What do I have to do if I want to pass result of MyAction#getRoot to my
dummy tag?

I've tried to these:
<pext:drawTree tree="root"/>
<pext:drawTree tree="#{root}"/>
<pext:drawTree tree="${root}"/>
<pext:drawTree tree="%{root}"/>

Nothing happens, i tag I get String with value "root" or get null. 

I can't pass an object to tag attribute... ((((

What do I do wrong?
-- 
View this message in context: http://old.nabble.com/How-to-pass-date-from-action-to-custom-jsp-tag--tp30144287p30144287.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message