struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel PC Leung <pc.le...@gmail.com>
Subject How can the controller class of Tiles get the attribute of other Action class?
Date Tue, 22 Feb 2005 01:32:08 GMT
I have the following controller class.
I would like to change the parameter of
createMenuItem dynamically based on the 
user group after login.

How can the controller class of Tiles get the attribute of
of other Action class?

Thanks

public class MyMenuAction implements Controller  {
	private MenuItem createMenuItem (String label, String link) {
	    SimpleMenuItem item = new SimpleMenuItem();
	    item.setLink(link);
	    item.setValue(label);
	    return item;
	  }
	  private List getLinks() {
	    List list = new ArrayList();
	    list.add(createMenuItem ("Option1", "/option1"));
	    list.add(createMenuItem ("Option2", "/option2"));
	    list.add(createMenuItem ("Option3", "/option3"));
	    return list;
	  }

	  public void perform (ComponentContext context,
	                       HttpServletRequest request,
	                       HttpServletResponse response,
	                       ServletContext servletContext)
	                throws ServletException, IOException {
	    List items = (List) getLinks();
	    context.putAttribute ("items", items);
	  }
}

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


Mime
View raw message