Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 26099 invoked from network); 26 Aug 2008 17:31:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Aug 2008 17:31:21 -0000 Received: (qmail 25893 invoked by uid 500); 26 Aug 2008 17:31:09 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 25872 invoked by uid 500); 26 Aug 2008 17:31:09 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 25854 invoked by uid 99); 26 Aug 2008 17:31:09 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Aug 2008 10:31:09 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of chriss.nold@gmail.com designates 74.125.44.29 as permitted sender) Received: from [74.125.44.29] (HELO yx-out-2324.google.com) (74.125.44.29) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Aug 2008 17:30:12 +0000 Received: by yx-out-2324.google.com with SMTP id 8so1144640yxg.17 for ; Tue, 26 Aug 2008 10:30:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type; bh=AejAwZiv5BskmaIoKWb4BI+6P6eJ1iwQkWMMwFKhmhY=; b=mtDqgJcjo6M5rbfd6ySdQLNVcIEpw3hh9vdaIhW+muChBJ4UrN/8kBrKxXcU0yl5g4 wb93hGkFMOOCe2DJD864kHQF8k0/Hd8X0f53bAHTvuMDjyLJmEj55gSUNhnlCUG8RBXG yCuFfoqMris7fwSEeYDKM6zdLeupaTa4PCFSU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=m83WzolORQUCop62NBfnWW5VAwVhTavn1PNuKPudJEULvtK6c3ukm44IEK8YF5r/Re f+UTfBQ4HgYZ4pL3pL2Ypyrq12rZsChWnoCuOJaEz+621zUvMRL6PBTOrnmytxmmnqlT cMSWHS1+bRQl9Z5F5OJ2QuR0UMXt4CD9Dox3g= Received: by 10.142.188.4 with SMTP id l4mr2087028wff.183.1219771840702; Tue, 26 Aug 2008 10:30:40 -0700 (PDT) Received: by 10.142.141.8 with HTTP; Tue, 26 Aug 2008 10:30:40 -0700 (PDT) Message-ID: <7e78851c0808261030y12b8b47ap8126ebba5dc5e1a6@mail.gmail.com> Date: Tue, 26 Aug 2008 12:30:40 -0500 From: "Chriss Nold" To: "struts mail list" Subject: Using iterator tag to retrieve list from session MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_8981_21701863.1219771840686" X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_8981_21701863.1219771840686 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hello All, I am trying to retreive a list from the session and display that list on a jsp, but I am not entirely sure of the correct syntax for reading the list. Any help would be appreciated. Here is the code that I am cuurently using: Action class: package round; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import java.util.Map; import com.opensymphony.xwork2.ActionContext; import example.ExampleSupport; public class GetListAction extends ExampleSupport{ public String getList() throws SQLException { Round round = new Round(); List eventList = new ArrayList(); Map session = (Map)ActionContext.getContext().get("session"); String userName = String.valueOf(session.get("userName")); try { Statement stmt; Class.forName("com.mysql.jdbc.Driver"); String url = "jdbc:mysql://localhost:3306/Nexus"; String sql = "Select * " + "FROM round WHERE userName='" + userName + "'"; Connection con = DriverManager.getConnection( url,"root", "*****"); stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(sql); while(rs.next()){ round.setMatchID(rs.getInt(1)); round.setEventID(rs.getInt(2)); round.setUserName(rs.getString(3)); round.setRound(rs.getInt(4)); round.setPersona(rs.getString(5)); round.setResult(rs.getInt(6)); round.setOpponent(rs.getString(7)); eventList.add(round); } con.close(); }catch( Exception e ) { e.printStackTrace(); } session.put("eventList", eventList); System.err.println("Session objects: " + session.get("eventList")); return SUCCESS; } } Query is successful, and System.err.println displays: Session objects: [round.Round@1cd6782] JSP: <%@taglib prefix="s" uri="/struts-tags" %> Welcome to Nexus!!!

Welcome to the Nexus,

Match ID Event ID Persona Used Opponent Result Round
Displays users first name, but not the list. Struts2 mapping: /jsp/tournament/tournamentList.jsp Thanks in advance for the help, Chriss ------=_Part_8981_21701863.1219771840686--