Take the tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

im kind of new at programming, so i really don't know how to make this work, i have some jsp files to upload some forms to a database, but when i try to send the form y get that exception.

I was googling it and i add some libs to the projects but it wont work, any help please ._.?

package res.ser.controlador;

import com.oreilly.servlet.multipart.*;
import java.io.File;
import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Hashtable;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import javazoom.upload.MultipartFormDataRequest;
import javazoom.upload.UploadBean;
import javazoom.upload.UploadFile;
import res.ms.sqlserver.SolRespaldo;
import res.ms.sqlserver.SolRestauracion;
import res.smtp.ForCorreo;

import com.smtp.AdmCorreo;

/**
 * Servlet implementation class SRSolicitud
 */
public class SRSolicitud extends HttpServlet {
private static final long serialVersionUID = 1L;

/**
 * Default constructor. 
 */
public SRSolicitud() {
    // TODO Auto-generated constructor stub
}

/**
 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
 */
@SuppressWarnings("unchecked")
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // TODO Auto-generated method stub
    int idUsuario = 0;
    try
    {
        idUsuario = ((com.bean.Usuario) request.getSession().getAttribute("usuario")).getIdUsuario();
    }
    catch (Exception ex)
    {           
    }
    if (MultipartFormDataRequest.isMultipartFormData(request))
    {
        MultipartFormDataRequest mulForDatRequest = null;
        try 
        {
            mulForDatRequest = new MultipartFormDataRequest(request);
        } 
        catch (Exception exception) 
        {               
        }
        if (mulForDatRequest != null)
        {
            Hashtable archivos = mulForDatRequest.getFiles();
            UploadFile archivo = null;
            UploadBean upLoaBean = null;
            if ((archivos != null) && (!archivos.isEmpty()) )
            {
                archivo = (UploadFile) archivos.get("archivo");
                upLoaBean = new UploadBean();
            }
               try
               {
                    upLoaBean.setFolderstore(new com.utilidad.Utilidad().obtRutAplicacion()+"archivosTemporales/");
                    upLoaBean.store(mulForDatRequest, "archivo");
               }
               catch (Exception exception)
               {
               }
               String nomArchivo = null;
               try
               {
                   nomArchivo = archivo.getFileName();
               }
               catch (Exception ex)
               {                       
               }
               String tipSolicitud = null;
               try
               {
                   tipSolicitud = mulForDatRequest.getParameter("rTipo").toString();
               }
               catch (Exception exception)
               {            
               }
               if (tipSolicitud!=null)
               {
                   AdmCorreo admCorreo = new AdmCorreo(request);
                   String cueMensaje = null;
                   //String[] para={"[email protected]"};
                   String[] para={"[email protected]"};
                   //String[] copCarbon={"[email protected]"};
                   String[] copCarbon={"[email protected]"};
                   String[] copCarOculta=null;
                   //para respaldos
                   if (tipSolicitud.equals("respaldo"))
                   {
                       String repeticion = null;
                       try
                       {
                           repeticion = mulForDatRequest.getParameter("rTRespaldo");
                       }
                       catch (Exception ex)
                       {        
share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

You need to add the class file of com.oreilly.servlet.multipart.MultipartParser in your WEB-INF/lib folder of your Container.

share|improve this answer
 
Thanks, it worked, no errors this time, i still can se the data on the database but thats another problem Thank you! –  Erick Reyes Jun 15 at 16:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.