Hi, I have been facing problems populating drop-downs using
dummy stub classes .I have used a function to populate the page containing the drop-down
and thrown the Action Form type object into the session. Now how do I retrieve the values on to my jsp screen. Here
is the code snippet.. Action Class: ……………… form = populate(request, iFlag); session.setAttribute("com.itest.web.form.SelectionForm", form); …………………. ………………….. public ActionForm
populate(HttpServletRequest
request) { SelectionForm form = new SelectionForm(); ArrayList arlproject = ProjectData.getProjects(); ListIterator iter = arlproject.listIterator(); while
(iter.hasNext()) { Project proj = (Project)
iter.next(); System.out.println("++++++++++++++++"
+ (String)proj.getProjectcode()); form.setProjects((String)proj.getProjectcode()); } return
form; } SelectionForm.java public void setProjects(String strProject) { System.out.println("rrrrrrrrrrrrrrrrrr"); String strKey="proj"+index; System.out.println("rrrrrrrrrrrrrrrrrr"+strKey); if
(this.htbSelect.containsKey(strKey)) { index++; strKey="proj"+index; } //this.htbSelect.remove("proj"); this.htbSelect.put(strKey,strProject); System.out.println("rrrrrrrrrrrrrrrrrr"+index); System.out.println("iiiiiiiiiiiiii"+htbSelect.get(strKey)); } public
ArrayList getProjects() { ArrayList arlProject=new
ArrayList(); System.out.println("111111111111111111111111111"+index); for(int i=0;i<index;i++) { String strKey="proj"+i; String proj=(String)this.htbSelect.get(strKey); arlProject.add(proj); } return(arlProject); } Regrads Santosh Kumar Panda Software Engineer HTDM(extn.2680) |
- Re: Populating drop-downs Santosh Kumar Panda
- Re: Populating drop-downs Rick Reumann
- Re: Populating drop-downs Tak Yoshida