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
//aList is not null.It definitely some size
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�