This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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.....
Thanks for the reply. Let me check out the links and try out. If there is a problem implementing it, Would get back to you.
Yogendra N Joshi.
Joined: Apr 04, 2006
Hi Merill ,
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):
Joined: Apr 04, 2006
Hello Brent ,
Thanks for the help.. Not being successful..
Can you please elaborate more. Also i would wish Merrill to help in this case...
Thanks in Advance. Yogendra Joshi.
Joined: Feb 15, 2005
You will need to be more specific than "not being successful". Give us the specific error message and tell us at what point it occurs (When the page submits? when it is displayed for the first time?).
I assume you modified your code according to Brent's suggestions. Can you show us the modified code?
Joined: Feb 08, 2006
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