This time i am in a confusion as to how to generate Dynamic Textboxes based on the values coming from the database.
For instance , There are four fields called jobType,ItemCode,Quantity and Rate which would be coming from the Database. Based on the size of the Collection i.e ArrayList , on the JSP corresponding number of Textboxes should get generated automatically with all the details populated.
Can you shred some light on how this can be achieved ?
Thanks in Advance.
Yogendra N Joshi
Meri Zindagi Hain Tab Tak.. Jab Tak Tera Sahara.... Har Taraf Tu Hi Tu Hain SAI Tera Hi Hain Nazara.....
According to what you helped , I tried doing it but facing a problem called "No Collection Found" and sometimes i get "Cannot create iterator for..". These are my all files , Appreciate if you can help me out.
Action Class: Looks pretty good though you can probably remove the call request.setAttribute..and in any case you would not want to call this every time through the loop.
Action Form: For indexed properties you need methods that take an index as a parameter. Like the following. It has been a little while since I have written index properties for simple types like String, so this might not be exactly right. The method getTxtItem might not be needed.
JSP File: You then need to hook your JSP code up to use the txtItem indexed methods in your form. The following might be correct. Again, I am not sure of the syntax for simple types like Strings.
For the longest time I did not understand how to get indexed properties working (mostly because I did not know that the id attribute of the logic:iterate tag should match up with the property name in the form) so I would hand roll the index code like this (in which case the method getTxtItem is needed in the form):
here...requestURI="/disputeOrValidate.do?method=DISPUTEORVALIDATE" is the action to be called for displayin the values and name="sessionScope.ChargeAnalysisListVO.chargeAnalysisList" is the Object and its arraylist in session or request scope