herewith i enclosed the file which contains the actionclass,form bean,view part

in this enclosed file the  attachment and url are KEY and VALUE pairs in hashtable ie) 
which i got from DB.
and i've to display these value in textfiled[url] based on the key selected  in the 
html:options.

i need help to identify.


This is my Form bean

package com.calsoft.ecm;

import java.util.Collection;
import java.util.Hashtable;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;


public class AttachForm extends ActionForm{
    
 private Hashtable values = new Hashtable();
 private Collection webLink = null;
 private String linkVal = null;
 private String url = null;
 private String attachment = null;
 
 public void setValue(String attachment,Object url)
 {
  values.put(attachment,url);
  
 }
 public Object getValue(String attachment)
 {
  return values.get(attachment);
 }
 

 public void reset(ActionMapping mapping,HttpServletRequest request)
 {
  values = new Hashtable();
 }
 
 /**
  * @return Returns the linkVal.
  */
 public String getLinkVal() {
  return linkVal;
 }
 /**
  * @param linkVal The linkVal to set.
  */
 public void setLinkVal(String linkVal) {
  this.linkVal = linkVal;
 }
 /**
  * @return Returns the url.
  */
 public String getUrl() {
  return url;
 }
 /**
  * @param url The url to set.
  */
 public void setUrl(String url) {
  this.url = url;
 }
 
 
 /**
  * @return Returns the attachment.
  */
 public String getAttachment() {
  return attachment;
 }
 /**
  * @param attachment The attachment to set.
  */
 public void setAttachment(String attachment) {
  this.attachment = attachment;
 }
 
 /**
  * @return Returns the webLink.
  */
 public Collection getWebLink() {
  return webLink;
 }
 /**
  * @param webLink The webLink to set.
  */
 public void setWebLink(Collection webLink) {
  this.webLink = webLink;
 }
}
******************************************************************
My Action Class

package com.calsoft.ecm;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.Hashtable;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;


public class AttachAction extends Action {
 
  Hashtable hswebLink = new Hashtable();
    Enumeration enu;
    Collection collect = null;
    ArrayList arrayCollect = new ArrayList();
    String weblink = new String();
    String attachment = null;
    Object webUrl = null;
    String userLink = null;
    String userUrl = null;
 public ActionForward execute (ActionMapping mapping,
      ActionForm form,HttpServletRequest request,
      HttpServletResponse response)throws IOException, ServletException 
  {
  try {
   hswebLink = new Hashtable();  
   AttachForm attachForm = (AttachForm) form;
   userLink = attachForm.getAttachment();
   
   WeblinkConfigDAO web = new WeblinkConfigDAO(); 
   hswebLink = web.getWebLinks();
   
   enu = hswebLink.keys();
             //  hswebLink.values();
   while(enu.hasMoreElements())
   {
        weblink =(String) enu.nextElement();
        arrayCollect.add(weblink); // here the pbms
        collect = arrayCollect;
          webUrl = hswebLink.get(weblink);
    //   webUrl = hswebLink.get(weblink).toString();
      System.out.println("****[weblink]****"+weblink); it works fine
      System.out.println("****[webUrl]****"+webUrl); it works fine
         
   }
 attachForm.setWebLink(collect); // here the pbms 
  attachForm.setValue(weblink,webUrl);
  String userUrl = (String) attachForm.getValue(userLink);
  attachForm.setUrl(userUrl);   

   
  } catch (Exception e) {
    e.printStackTrace();
  }
  return (mapping.findForward("attachment"));
 
}
}

**************************************************************
my jsp 
 <TR> 
    <TD width=144  class="td_oddrows"> <div align="left">Attachment Name</div></TD>
    <TD width="159"  class="td_oddrows">
    <html:select property="attachment" name="attachForm">
  <html:options  property="webLink"    />
   </html:select>
    
     </TD>
  </TR>
  <TR> 
    <TD  class="td_evenrows"> <div align="left">URL </div></TD>
    <TD class="td_evenrows"> <html:text property="url"  /></TD>
  </TR>

***********************************************************
in this enclosed file the  attachment and url are KEY and VALUE pairs in hashtable ie) 
which i got from DB.
and i've to display these value in textfiled[url] based on the key selected  in the 
html:options.






Reply via email to