Ciao ragazzi ho un gran problema. Io devo fare un sito con servlet e jsp e tra le varie funzionalità devo creare e leggere file di word. La lettura riesco a farla se faccio i file a mano ma se li creo tramite la servlet no come mai vi metto i codici cosi potete dirmi il problema.
Se avete link o esempi da prendere vi sarei grato:

LETTURA:

codice:
package wordreader;

import java.io.*;
 
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.hwpf.extractor.WordExtractor; 
 
		public class ProvaServlet extends HttpServlet {
   				
			 protected void doGet(HttpServletRequest request,
           				 HttpServletResponse response) throws ServletException, IOException {
         
      				response.setContentType("text/html");
         
        	

				String filename ="\\WEB-INF\\prova.doc";
        			String contents = "";
        			ServletContext context = getServletContext();
         
        
        		
				InputStream is =context.getResourceAsStream(filename);
				
      		
				try{
           				 POIFSFileSystem fs = new POIFSFileSystem(is);
           				 WordExtractor we = new WordExtractor(fs);
                    			 contents = we.getText();
        			}catch(IOException e){
                			e.printStackTrace();
				 }

       			
            			PrintWriter writer = response.getWriter();
          			writer.println("<html><head></head><body>");
             			writer.println(contents);
				writer.println("</body></html>");	
            
        }
  }
SCRITTURA
codice:
package wordreader;

import javax.servlet.http.*;
import javax.servlet.*;
import java.io.*;


public class ScriviFile extends HttpServlet {
  	
   public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException	
   {	
	
    try {
      FileOutputStream file = new FileOutputStream(getServletContext().getRealPath("\\") + "WEB-INF\\prova.doc");
      PrintStream Output = new PrintStream(file);
      Output.println("Ciao mi chiamo marco e sono intelligente");
    	} catch (IOException e) {
      	System.out.println("Errore: " + e);
 
          }
  } 
}
Grazie