The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
December 2000



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.



Posted by Kishori Sharan on December 22, 2000 at 9:46 AM

It all depends on your requirements and designs. If the values you have to display in textfield corresponding to the value selected in the dropdown are fixed but not many e.g. 10 to 20 options then you can fetch those values in one go and on onChange of dropdown you can display the correcsponding value in text field without hitting webserver and/or database. Of course, you will have to do some javascript manipulations.However, if the list of values to be displayed in textfield is big then better do your way. We were working on a document management system in a last couple of weeks and we had a similar situation. We had to display the list of projects and when user selects one project then we had to display all teams under that project and when user selects a team then we had to display all documents type for that team and so on... We did it as follows.
1) Create one frame for each e.g projects, teams, document type etc.
2) On load of project frame ( as well as for onChange ) select the first item and then submit the form whereas set the target of the project form as team frame, so in jsp read the value of project and populate the team list box.... In team form we also put a hidden field that stores the current project so that next time when we submit the team form we don't have to do any exta processing for knwoing the project...
So far as use of session object is concerned I try to avoid it. However, if you cannot avoid its use for storing data of forms then at least remove the key in which you store data after use so that you don't use the old data by mistake.



Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us