File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes upload image usinng struts2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "upload image usinng struts2" Watch "upload image usinng struts2" New topic

upload image usinng struts2

Rahul Bhalla

Joined: Jan 28, 2012
Posts: 17
Hello Every one
I m new Struts 2 and i m trying to upload a image on server with the help of struts 2 but i was unable to do that i m pasting my code here ..
please tell where i m wrong

here is my action class

my beans class is

now my jsp from where i set my bean

my property file


when i deploy my application i got nullpointerexception and on line number 28 of the action class i found it prints null on server
please suggest me what can i do...
thanking you
Rahul Bhalla

Joined: Jan 28, 2012
Posts: 17
by mistake i put my problem on jsp forum sorry for that .if you able to help please post your reply on given link
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

have you tried this.

And refer this link. Struts2 FileUpload Setting FilePath

ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
Rahul Bhalla

Joined: Jan 28, 2012
Posts: 17
Thanks Mohana for the reply
I found problem as it need to change setter from setLogoName to set setLogoFileName
I agree. Here's the link:
subject: upload image usinng struts2
It's not a secret anymore!