#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2002
    Posts
    0
    Rep Power
    0

    passing multiple values


    I don't know if this is possible and it's difficult to explain. I have a form which shows a list of records from a table. Beside each record there is a checkbox. If the checkbox is checked it takes the value from the first field and passes it onto the next page. But what I want to do is when the box is checked I want to pass on the values from the first two fields as it's a combined primary and I'm using these values for a search condition where in delete sql statement. Here is the code for passing one value is it possible to pass two??

    for (int i=0;i<v1.size();i++)

    {
    %>
    <tr><td><%=v1.get(i)%></td>
    <td><%=v2.get(i)%></td>
    <td><%=v3.get(i)%></td>
    <td><center><input type=checkbox name=delete value="<%=v1.get(i)%>"></td>
    </tr>
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2002
    Location
    Boston, MA
    Posts
    30
    Rep Power
    57
    Tough question. There's really not enough info there to address it well, so forgive me if I missed your point.

    It looks like you have declared (somewhere, at some point) a Vector v1.

    It also appears that this Vector contains form data and checkbox info that needs processing. Right so far?

    If I am correct, I'd suggest that you write a separate void class that accepts a Vector and pass v1 to this class:

    Code:
    public void processV1(Vector v1){
    
       synchronized(v1){
           . . . 
       }
        . . . 
    
    }

    Another possibility:
    Code:
    Vector v1 = parametersToVector(request.getParameterNames(), request);
    
    public Vector parametersToVector(Enumeration enumeration, HttpServletRequest request){
        Vector v = new Vector();
        String param;
    
        if(enumeration == null) return v;
        
        // process Hashtable of parameters
         while( enumeration.hasMoreElements() ) {
         try{
             param = enumeration.nextElement();
        }
        catch(NoSuchElementException nsee){}
        
         . . .
            
        }
    }
    Kind of awkward using the second way. It's a good idea to whisk the logic out of the page though.

    If I didn't answer you question, provide more detail.

IMN logo majestic logo threadwatch logo seochat tools logo