I need to download excel file from our SharePoint web site, enter some values there and upload it back. I never did this type of work before – it is my second java project in general, and I am goggling a lot. In the snippet below I am trying just to download “A Test Counts.xlsl” file.
When I run this class from eclipse, I get the following
Exception in thread "main" java.lang.NullPointerException
I realize that value of the response variable is null and hence the exception. Tutorials that I read
Please be sure to use code tags when posting code to the forums. Unformatted or unindented code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please click this link ⇒ UseCodeTags ⇐ for more information. Properly indented and formatted code greatly increases the probability that your question will get quicker, better answers.
I've gone ahead and added the code tags for you. See how much easier the code is to read? (And makes it unnecessary to add your own line numbers.)
Servlets aren't executed like "normal" Java programs that have a main() function. Rather, they are bundled into a web application that is then executed by a servlet contains such as Tomcat, Webshpere, Glassfish, and so on.
If you need to write and execute a servlet, these are concept that you will need to learn. I recommend picking up a good book (Head First Servlets and JSP one is popular) and prepare to learn a lot.
On the other hand, based upon what you say you are trying to accomplish, I think you may be heading down the wrong path thinking that you need a servlet.
Can you expand on your actual goal?
Joined: Feb 23, 2012
My actual goal is to open the spreadsheet from the company’s web site, enter values (number of test cases for each product) in the spreadsheet and save it where it was on the web site. I already wrote java code that updates checked out code on my development box from subversion, calculates number of test cases for each product, finds the rows correspondent to the titles of the products in the spreadsheet, and enters those values in the spreadsheet saved on my development box. In reality, I have to open spreadsheet from the company’s website, not the copy that I saved locally, and as you mentioned some direction to head to would be helpful. (The one that I tried was obviously not the right one for this particular task).
Sharepoint? I believe that it exposes a collection of web services which allow programs to do that sort of thing. Probably you can download from Sharepoint as if it were an ordinary web site, but not upload. Although I have no experience with doing that.