I'm not sure what you exactly want to do,
with adding value to HashTable as set method,
and creating List from the HashTable as get method.
Anyway, if you want to acces that Form you created via poppulate method,
I guess you just write Struts tag with name attribute as the name you set in 
sesison,
even though codes gets strange.
I'm not sure why you don't use form object passed in Action class.

And speaking of pre-population of dropdown list,
Struts leaves the question "where we should implement?" to the application.
we need to think how to separate "process request" and "prepare for rendering".
and pre-population should be done in "prepare" cycle, and we want clear codes.
You'll see one of the solutions from
http://sourceforge.net/project/showfiles.php?group_id=111296&package_id=120334

Tak

Santosh Kumar Panda wrote in <[EMAIL PROTECTED]>
>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)
>
> 
>
> 
>
> 

-- 
Tak Yoshida mailto:[EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to