|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
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
|
|||
|
|||
|
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.
__________________
http://dhtmlkitchen.com/ |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Java Help > passing multiple values |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|