File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes JSP that converts office extensions to pdf and then upload them Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP that converts office extensions to pdf and then upload them" Watch "JSP that converts office extensions to pdf and then upload them" New topic
Author

JSP that converts office extensions to pdf and then upload them

Thiago Balducci
Greenhorn

Joined: Mar 22, 2010
Posts: 11
Hi there !

Im trying to convert office extensions ( .xls, .ppt, etc) to pdf and then upload the resulting file to a server .

currectly im using the upload solution using o'really, upload commons and java beans
and as for the conversion im using a solution which uses OpenOffice's lib to do the conversion.I'm going to post the codes of my JSP and my HTML ( which just contains the form to get the file to be converted and uploaded).

observation: the point which is giving me headaches is how to get the file sent by my form, convert it into a File object, use my conversion tool and then deliver it to my upload tool so it can be stored.... i cant seem to get the File object from the request object ( tried getattribute and it returns null....) .

observation':I do know about and how to use MVC but my boss asked me to make this work with just one JSP or a JSP and a HTML.

index.html :

Conversion.jsp :

upload portion:

conversion portion:



Both work just ok when separated but i cant get both to work together....

Any help is much appreciated!!!

Thanks in advance
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9302
    
  17

my boss asked me to make this work with just one JSP

IMHO, you should ask your boss to change his requirement. Converting the file type is pure programming logic. Putting programming code in JSP is not a good idea. You should use a Servlet to do the work for you. An HTML page can submit the request (with the .xls or whatever file) to the Servlet, and the Servlet will do the conversion. Also you cannot convert the file in the browser, the JSP code executes on the server, so you can't convert and then upload the file. You can convert it on the server side after uploading...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Thiago Balducci
Greenhorn

Joined: Mar 22, 2010
Posts: 11
Ankit Garg wrote:
my boss asked me to make this work with just one JSP

IMHO, you should ask your boss to change his requirement. Converting the file type is pure programming logic. Putting programming code in JSP is not a good idea. You should use a Servlet to do the work for you. An HTML page can submit the request (with the .xls or whatever file) to the Servlet, and the Servlet will do the conversion. Also you cannot convert the file in the browser, the JSP code executes on the server, so you can't convert and then upload the file. You can convert it on the server side after uploading...



yeah, i thought the same thing, i warned him about doing all this with just a JSP but he said it were to be done that way anyway.... x.x



thanks for your reply !
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP that converts office extensions to pdf and then upload them