473,394 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

File Upload using struts

Iam trying to upload file using struts but getting "file not found exception" please suggest!!! below is the code

public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
{
response.setContentType("text/html;charset=UTF-8");
PrintWriter out;
try {
out = response.getWriter();
} catch (IOException ex) {
ex.printStackTrace();
}
UploadFileForm uff=(UploadFileForm)form;
readExcel xlReader = new readExcel();
FormFile myfile= null;
FileInputStream fs=null;
try {
myfile=uff.getTheFile();
System.out.println(myfile.getFileName());
String path = getServlet().getServletContext().getRealPath("")+"/"+myfile.getFileName();

fs = new FileInputStream(new File(path));
contentReading(fs);
} catch (FileNotFoundException ex) {
ex.printStackTrace();
} catch (Exception e){
e.printStackTrace();
}
Oct 22 '09 #1
1 2442
Can someone please help
Oct 22 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Ron Brennan | last post by:
Good morning. I would like to allow a user to browse his local file system, choose an image (probably .jpeg) file, and upload it to the server (using a servlet) - the same functionality that...
13
by: Sky Sigal | last post by:
I have created an IHttpHandler that waits for uploads as attachments for a webmail interface, and saves it to a directory that is defined in config.xml. My question is the following: assuming...
1
by: JagPeram | last post by:
Can Anyone tell me how to upload file using ajax with struts framework?
4
by: AshishMishra16 | last post by:
HI friends, I am using the Flex to upload files to server. I m getting all the details about the file, but I m not able to upload it to Server. Here is the code i m using for both flex & for...
3
by: shanmukhi | last post by:
hi all, i got a problem with struts. iam unable to find it. i have written an action class, form bean class and a jsp page on submitting form, request is going to action class but it is not...
0
by: Laxmikumar | last post by:
Iam new to web services, Iam using net beans-5.5.1 IDE whlie deploying the web service application the following error is occured. can anyone help me..??? please. init: deps-module-jar:...
8
by: ajos | last post by:
hi frnds, the situation is im developing a web application in struts-- my specifications-eclipse3.2.2,struts1.1,tomcat5.5.23 mysql5.0 db. the scenario-i have a jsp page which adds the...
3
by: arasub | last post by:
ep 20, 2007 11:25:57 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found...
1
by: javaflower | last post by:
in JSP , this is the code snippet to upload a file <li><html:file property="myFile" value="../img/buttons/browse_button.gif"> </html:file> in my struts action class, i am fetching it like, int...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.