The value passed to tag attribute is a simple String. You have to EVALUATE IT as a expression to get the real value.
You can read the source of Struts2 tag lib to study how they evaluate the expression. For example: in class [org.apache.struts2.components.Property] (This class is invoked by tag <s:property>) it calls: actualValue = (String) getStack().findValue(value, String.class, throwExceptionOnELFailure); to retrieve the real value from the value expression Hope this helps. 2010/11/6 holod <serega.shey...@gmail.com>: > > 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-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org