This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
hi all, i have a jsp file in which the elements (eg. textfileds) are generated dynamically..wat is the best practice to name these elelemts.. is it a good practice append an int variable to the end of the textfilds name like txtfld1, txtfld2 ?? if i name all the textfields with the same name, is there any way to get the values of each of these textfields ?? thanks raj.
SCJP, SCWCD, SCBCD, Oracle Certified Professional (SQL n PL/SQL)
Yes, you can retrieve all the values if you name the fields the same by using request.getParameterValues() (rather than request.getParameter()). However, you will not be able to tell which value came from which field. If that is an important distinction, then you will need to assign each field a unique name. Which makes the most sense depends upon how your submission target needs to deal with the fields, which you did not discuss in your original question. hth, bear