If I understand what you are trying to do:

Create an array of String to hold the member numbers *outside* the for loop,
fill the array *inside* the array loop, and put the String array (now filled
with member numbers) in the session *outside* the for loop (at the end of
the for loop).  You will now have an array of all member numbers in session:

String[] members = new String[newTable.length];
...
// for loop goes here
for (int i = 0; i < x; ++i)
{
...
   members[i] = mn;
}
// end of for loop
session.setAttribute("MemberNos", members);

HTH.
----- Original Message -----
From: Kate Hocking <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, November 23, 2000 12:57 AM
Subject: binding parameters to sessions dynamically


> Hi all,
>
> I was wondering if anyone knew of anyway to bind a value to a session
within
> a "for" loop without overwriting the previous session value.
> The problem is session.setAttribute() will always overwrite the value of
the
> previous session, so when i get to the end of the for loop, the session
will
> always pass the last parameter value to the servlet.
>
> I want to pass the specific values to the session the user clicking on the
> hyperlink that invokes the servlet.
>
> cheers,
> Kate.
>
>
> *****************************************************
> <PRE>
>         <%
>                 int x = newTable.length;
>
>                 for (int i=0; i<x; i++){
>
>                         String outString = newTable[i];
>
>                         file://extract the member number from the String
>
>                         StringTokenizer st = new
StringTokenizer(outString,
> " ", false);
>                         String mn = st.nextToken();
>                         String s = st.nextToken();
>                         String fn = st.nextToken();
>
>
>                                 String[] member = new String[1];
>                                 member[0] = mn;
>
>                                 session.setAttribute("MemberNo", member);
>
>
>                                 out.println("<A
> HREF='http://healthtest:80/gmfhealth/servlet/AbsoluteServlet'><FONT
> COLOR=#FFFFFF SIZE=1 FACE=arial, helvetica>" + mn + " " + s + " " + fn +
> "</FONT><BR><BR></A>");
>
>                  }
>
>
>
>         %>
>
> </PRE>
> *****************************************************
>
____________________________________________________________________________
> ________________________________________
>
> IMPORTANT:  This email is intended only for the use of the individual or
> entity named above and may contain information that is confidential and
> privileged. The views expressed in this e-mail are those of the author and
> not of the company unless otherwise clearly indicated.  When addressed to
> our clients, any information or quotes contained in this e-mail are
subject
> to the terms and conditions relevant at that time to the matter being
> addressed.  If you are not the intended recipient and have received this
> e-mail in error, please notify us immediately by return email or telephone
> +61 8 93235555 and delete the e-mail and any attachments without using or
> disclosing the contents in any way.  If you are not the intended recipient
> any dissemination, distribution or copying of this e-mail is strictly
> prohibited. Before opening or using attachments, check them for viruses
and
> defects.  Our liability is limited to re-supplying any affected
attachments.
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to