simple displayTag example or tutorial -------------------------------------
Key: DISPL-265 URL: http://jira.codehaus.org/browse/DISPL-265 Project: DisplayTag Type: Test Components: Examples public class User { private String id; private String password; private String completeName; public void setId(String id){ this.id = id; } public void setPassword(String password){ this.password = password; } public void setCompleteName(String completeName){ this.completeName = completeName; } public String getId(){ return id; } public String getPassword(){ return password; } public String getCompleteName(){ return completeName; } } method(){ User u1 = new User(); u1.setId("1"); u1.setPassword("abc"); u1.setCompleteName("Ali Ahmed"); User u2 = new User(); u2.setId("1"); u2.setPassword("abc"); u2.setCompleteName("Ali Ahmed"); User u3 = new User(); u3.setId("1"); u3.setPassword("abc"); u3.setCompleteName("Ali Ahmed"); List list = new ArrayList(); list.add(u1); list.add(u2); list.add(u3); request.setAttribute("list", list); } <display:table name="list" id="_user"> <% User u = (User) _user; %> <display:column title="User ID" sortable="true"> <a href="AccountInformation.do?id=<%= u.getId() %>"> u.getId() </a> </display:column> <display:column title="User Password" property="password" sortable="true"/> <display:column title="Complete Name" property="completeName" sortable="true"/> </display:table> ---------------------------------------------------------------------------------------------------------------------- displaytag tutorial with vector or any collection ---------------------------------------------------------------------------------------------------------------------- <%@ taglib uri="/WEB-INF/displaytag-12.tld" prefix="display" %> <%@ page import="java.util.*"%> <% Vector mn = new Vector(); Vector child= null; child = new Vector(); child.addElement(new Integer(1)); child.addElement("--"); child.addElement("**"); mn.add(child); child = new Vector(); child.addElement(new Integer(2)); child.addElement("=="); child.addElement("&&"); mn.add(child); child = new Vector(); child.addElement(new Integer(3)); child.addElement("$$"); child.addElement("@@"); mn.add(child); request.setAttribute("table",mn); %> <display:table name="table" id="_table"> <display:setProperty name="basic.empty.showtable" value="true"/> <%Vector temp= (Vector)_table;%> <display:column title="No#" sortable="true"> <%=temp.elementAt(0)%> </display:column> <display:column title="Name" sortable="true"> <%=temp.elementAt(1)%> </display:column> <display:column title="Expression" sortable="true"> <%=temp.elementAt(2)%> </display:column> </display:table> -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click _______________________________________________ displaytag-devel mailing list displaytag-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/displaytag-devel