I have a scenario where in I'm suppose to generate same form multiple times. My application is based on spring 3.0 framework.
Scenario: Basically I'm designing this application for transportation company, where there is a requirement to schedule the loads )which driver carries which load and when and from which origin to which destination). Now, the problem is some times loads will not be directly delivered from origin to destination, there will splits in delivery, for example, one driver will carry loads up to some point from origin and again another driver carries it from that point to destination. But the number of splits may vary very time.
So i need to generate multiple form dynamically based on number of splits to schedule the loads like
Enter first splits information
--------------------------------
form1
----------------------------------
Enter second splits information
--------------------------------
form2
-------------------------------
submit button
You can do something as below,
First in any of your jquery
function in your jsp
page add following code,
for(var i=0; i<lcount;i++){ //lcount is number of splits.
$('#tload'+i).load('url of controller class that helps in loading form');
}
Write some divs
in same jsp page with id
as 'tload1','tload2','tload3'
so on.
<div id="tload1"></div>
<div id="tload2"></div>
<div id="tload3"></div>
............
............
so on
whenever returning from your controller return to jsp page that contains iframe which loads your form. By Using .load()
function as shown above will automatically load iframe
containing your forms into respective div tags
.That's it, your problem is sloved.