aspose file tools*
The moose likes Struts and the fly likes Problem in inserting image in Struts 1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem in inserting image in Struts 1" Watch "Problem in inserting image in Struts 1" New topic
Author

Problem in inserting image in Struts 1

vivek mahajan
Greenhorn

Joined: Jun 18, 2009
Posts: 22
Hi Friends,
I want to insert image file into the database for that i am using Bean as follows

and in my Action Class i am using the form bean as

I am getting an exception as java.io.FileNotFoundException: demo.jpeg (No such file or directory)
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

http://www.coderanch.com/t/282147/JSP/java/java-io-FileNotFoundException


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
vivek mahajan
Greenhorn

Joined: Jun 18, 2009
Posts: 22
Thanks Sagar
But the page which you suggested me shows the same technique as I have used with JSP and servlets (enctype="multipart/form-data"). With Struts do I need to follow the same technique or it has some thing different for form upload.
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

vivek mahajan wrote:With Struts do I need to follow the same technique or it has some thing different for form upload.

Not really, but you can any time use Struts 1 FormFile class to leverage the file upload thing
Here are the two links I found:
http://wiki.apache.org/struts/StrutsFileUpload
http://www.vaannila.com/struts/struts-example/struts-file-upload-example-1.html
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem in inserting image in Struts 1