Check if your Array list.size in actionForm isnt 0.
And i suggest dont instantiate a new Array object in
Form bean becoz when your setter method failed for
some reason, when you do get you wont get any error
becoz you create an empty ArrayList and it will be
returned. Its better if you only declare or set it to
null, so you will get exception when it return null.

--- ganesh g <[EMAIL PROTECTED]> wrote:
> Hi Friends,
> ThanQ very much 4ur non-stop help towards me.
> Here is a problem with Typecasting,throws
> ClassCastException.
> I'm not able get why it's getting.Bcoz i spent on
> this problem around 2weeks.
> i'm very thankful to u for ur solution.
>  
> Problem of Area is as Follows:
>  
> i've myown class called "FileProperties"
>  
> Step:1
>  
> public class FileProperties
> {
>   private long fileSize;
>   private Date fileDate;
>   private String filename;
>   private String filepath;
>   private String clientid;
> ...................................some other
> properties..........
> 
>   public FileProperties()
>   {
>   }
>   public String getFilename()
>   {
>   return filename;
>   }
>   public void setFilename(String filename)
>   {
>   this.filename = filename;
>   }
> 
>   public String getFilepath()
>   {
>   return filepath;
>   }
>   public void setFilepath(String filepath)
>   {
>    this.filepath = filepath;
>   }
> ...................some other getter/setter
> methods.........
> }
> 
> Step:2
>  
> In actionForm called mtActionForm i declared as
> follows:
>  
> public class MtActionForm extends ActionForm
> {
> private FileProperties singleFile;
> private Collection mtJobsList=new ArrayList();
> ...................................some other
> properties..........
> 
>   public Collection getMtJobsList() {
>   return mtJobsList;
>   }
>   public void setMtJobsList(Collection mtJobsList) {
>   this.mtJobsList = mtJobsList;
>   }
>   public FileProperties getSingleFile()
>   {
>     return singleFile;
>   }
>   public void setSingleFile(FileProperties
> singleFile)
>   {
>     this.singleFile = singleFile;
>   }
> 
>  
> 
> }
> Now i'm showing u exact problem of Area
>  
> Step:3
>  
> MtActionForm mtForm = (MtActionForm)actionForm;
> String tempStr =
> httpServletRequest.getParameter("fileIndex");
> int index = Integer.parseInt(tempStr);
> ArrayList aList =
> (ArrayList)mtForm.getMtJobsList();//No exception
> Here
>  
> FileProperties sFile =(FileProperties
> )aList.get(index);//This is where 
> ClassCastException thrown
>  
> mtForm.setSingleFile(sFile);
> 
> Step:4
>  
> In Jsp i'm going to use as follows
>  
> <bean:write name="mtActionForm"
> property="singleFile.filename"/>
>  
> I'm eagerly awaiting your reply as soon as possible.
>  
> Thanks & Regards
> Ganesh
>  
> 
>               
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Photos: High-quality 4x6 digital prints for
25¢


=====
==
thx,
a Java Student


        
                
__________________________________
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢
http://photos.yahoo.com/ph/print_splash

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

Reply via email to