Thanks a lot for the prompt reply with an alternate solution, this
solution definitely looks better then what I was trying.
-Sachin
>>> [EMAIL PROTECTED] 6/28/2003 9:33:43 PM >>>
My solution to this sort of thing is use multiple items with a
surrogate
key (if you want)...
i.e.
<input type="hidden" name="taskid" value="1"/>
$taskName
<input type="text" name="effort" value="0"/>
<input type="hidden" name="taskid" value="1"/>
$taskName
<input type="text" name="effort" value="0"/>
<input type="hidden" name="taskid" value="2"/>
$taskName
<input type="text" name="effort" value="0"/>
<input type="hidden" name="taskid" value="3"/>
$taskName
<input type="text" name="effort" value="0"/>
<input type="hidden" name="taskid" value="4"/>
$taskName
<input type="text" name="effort" value="0"/>
and so on...
then on the server side you just do a
public void doInsert(RunData data, Context context) throws Exception {
int[] taskids = data.getParameters().getInts("taskid");
int[] efforts = data.getParameters().getInts("effort");
for (int i =0; i < taskids.length; i++) {
...
Do whatever you need to do with taskids[i] and efforts[i]
...
}
}
On Sat, 2003-06-28 at 03:00, Sachin Kumar wrote:
> Hi,
>
> I have to send data from a vm page to the server side where I could
> process it and save it into database.
> For example:
> Suppose I have a Effort Entry form, where I have
> Task Name Effort Spent
> T1 __________ a text field
> T2 __________
>
> The number of tasks is known dynamically, from database. I need to
fill
> the effort for the listed tasks and then call SAVE on it.
> Now my action method doInsert() is called which takes this data and
> save these multiple records in a TASK table in database.
> Here if you see, if I have 'N' tasks , then I have to create N
> varialbes which I am doing using velocityCount (like
> task$velocityCount). So the problem is that again on server side to
get
> the data I need to generate the same variable names. I know this is
not
> a good way, but would like to hear from any of you guys who have
better
> ideas /solution to do the same.
>
> Thanks in advance.
>
> Sachin
>
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
--
Michael Mainguy
(248)935-8507
[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]