This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Struts and the fly likes Interceptor not working Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "Interceptor not working" Watch "Interceptor not working" New topic
Author

Interceptor not working

suraj savaratkar
Ranch Hand

Joined: May 17, 2010
Posts: 51
Hi to all;
I am implementing such File uploading application as well as i am written an fileUpload interceptor in struts.xml file but
i dont know how to get related values of file into my Action class.

When i use like;
public String uploadFile()
{
File filePath = new File("/",uploadfile.getUploadFileName());
System.out.println(filePath);
return SUCCESS;
}


then it throws an error follows;
Caused by: Unable to load bean org.apache.struts2.dispatcher.multipart.MultiPartRequest (jakarta) - [unknown location]
at org.apache.struts2.config.BeanSelectionProvider$ObjectFactoryDelegateFactory.create(BeanSelectionProvider.java:247)
at com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:134)
... 20 more


What is the mean of this error
Can Somebody tell me.
Ankit Garg
Saloon Keeper

Joined: Aug 03, 2008
Posts: 9189
    
    2

I'm not sure what you are trying to say here. If you are using the default fileUpload interceptor provided by struts 2.x, then all you need to do is expose action properties corresponding to the file upload form field. So if your form which upload the file looks like this

Then in your Action class you can have three properties which will be automatically set the fileUpload interceptor. These are
The first object is the File object of the uploaded file, 2nd is the mime type of the file and the third is the name of the uploaded file...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Also make sure you have commons-io and commons-fileupload libraries deployed.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Interceptor not working
 
Similar Threads
interceptor not working
interceptor not working in struts 2
Interceptor make chages which Unknown to us.
include directive doubt
Struts2: file upload not working