Skip to content
Snippets Groups Projects
Commit 8e150889 authored by Fnac's avatar Fnac
Browse files

YA FUNCIONA LO DE SUBIR VARIOS ARCHIVOS y tambien he quitado la _ de las fotos de los comentarios

parent d067f860
Branches
No related tags found
No related merge requests found
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package servlet;
import conexionDB.clasificacionCategoriasDB;
import conexionDB.documentoDB;
import conexionDB.nookDB;
import java.io.IOException;
import java.sql.Date;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.http.Part;
import modelo.ClasificacionCategorias;
import modelo.Documento;
import modelo.Nook;
/**
*
* @author Fnac
*/
@WebServlet(name = "agregarArchivoSV", urlPatterns = {"/agregarArchivoSV"})
@MultipartConfig
public class agregarArchivoSV extends HttpServlet {
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
Part documento = request.getPart("documento");
String resumen = request.getParameter("resumen");
HttpSession sesion = request.getSession();
String userName = (String) sesion.getAttribute("usuario");
java.util.Date date = new java.util.Date();
Date fecha = new Date(date.getTime());
Nook nook = nookDB.ultimoNook(userName);
int idNook = nook.getIdNook();
Documento doc = new Documento();
doc.setNook(idNook);
doc.setNombre(documento.getSubmittedFileName());
doc.setFechaCreacion(fecha);
doc.setResumen(resumen);
doc.setFechaModificacion(fecha);
documentoDB.insert(doc);
documentoDB.insertDocu(idNook,documento);
String url = "/agregarArchivo.jsp";
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(url);
dispatcher.forward(request, response);
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
......@@ -47,10 +47,6 @@ public class crearNookSV extends HttpServlet {
String etiquetas = request.getParameter("etiquetas");
String resumen = request.getParameter("resumen");
Part documento = request.getPart("documento");
java.util.Date date = new java.util.Date();
Date fecha = new Date(date.getTime());
......@@ -70,14 +66,10 @@ public class crearNookSV extends HttpServlet {
nookDB.insert(nook);
Nook nookCreado = nookDB.ultimoNook(userName);
int idNook = nookCreado.getIdNook();
ClasificacionCategorias categoria = new ClasificacionCategorias();
categoria.setIdNook(idNook);
......@@ -85,19 +77,7 @@ public class crearNookSV extends HttpServlet {
clasificacionCategoriasDB.insert(categoria);
Documento doc = new Documento();
doc.setNook(idNook);
doc.setNombre(documento.getSubmittedFileName());
doc.setFechaCreacion(fecha);
doc.setFechaModificacion(fecha);
documentoDB.insert(doc);
documentoDB.insertDocu(idNook,documento);
String url = "/misNooksSV";
String url = "/agregarArchivo.jsp";
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(url);
dispatcher.forward(request, response);
}
......
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html lang="es">
<head>
<title>FileNook</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="style.css" rel="stylesheet">
</head>
<body >
<%
HttpSession sesion = request.getSession();
String userName = (String) sesion.getAttribute("usuario");
%>
<div class="content">
<header class="header">
<div class="container logo-nav-container">
<a href="/inicialSV" class="logo">FILENOOK</a>
<nav class="navigation">
<ul>
<li class="navigation-usuario"><a href="perfil.jsp"><%=userName%></a></li>
<li><a href="perfil.jsp"><img src="recuperarImagenesSV?userName=<%=userName%>"
class="imagenesUsuariosCabecera"
alt="Imagen del perfil de usuario"></a></li>
</ul>
</nav>
</div>
</header>
<main class="main">
<div class="container">
<h3 style="margin-top: 3rem;">AGREGAR ARCHIVOS</h3>
<div class="pag-agregarDocumento">
<form class="tablamensajetexto" method="post" enctype="multipart/form-data" action="/agregarArchivoSV" >
<div class="partes" >
<label for="resumen" class="descripcionNook" style="padding-right: 1em;">Descripcin:</label>
<input class="tablaNooktext" name="resumen" required>
</div>
<div class="partes" >
<label for="subirarchivo" class="SubirArchivo" style="padding-right: 2em;">Subir Archivo:</label>
</div>
<input type="file" name="documento" required> <!--multiple="multiple"-->
<div class="partes" >
<input type="submit" class="button mainaction" tabindex="10" id="agregar_Archivo" value="AGREGAR" >
<input type="submit" class="button mainaction" tabindex="10" id="terminar_archivo" onclick="window.location.href='misNooksSV'" value="TERMINAR" >
<input type="reset" class="button mainaction" tabindex="10" id="borrar_Archivo" value="BORRAR" >
</div>
</form>
</div>
</div>
</main>
</div>
<footer class="footer">
Proyecto Filenook - 2019 - Andrs Cabero Mata - Patricia Aguado Labrador - Rafael Higelmo San Milln - Santiago Blasco Arnaiz
</footer>
</body>
</html>
......@@ -35,7 +35,7 @@ and open the template in the editor.
<h3 style="margin-top: 3rem;">CREAR NOOK</h3>
<div class="pag-crearNook">
<form class="tablamensajetexto" method="post" enctype="multipart/form-data" action="/crearNookSV" >
<form class="tablamensajetexto" method="post" action="/crearNookSV" >
<div class="partes">
<label for="nombre" class="nombreNook" style="padding-right: 2.5em;">Nombre:</label>
......@@ -51,21 +51,9 @@ and open the template in the editor.
<label for="resumen" class="descripcionNook" style="padding-right: 1em;">Descripcin:</label>
<input class="tablaNooktext" name="resumen" required>
</div>
<div class="partes" >
<label for="subirarchivo" class="SubirArchivo" style="padding-right: 2em;">Subir Archivo:</label>
</div>
<input type="file" name="documento" required> <!--multiple="multiple"-->
<div class="partes" >
<textarea class="archivosSubidos"></textarea>
</div>
<div class="partes" >
<input type="submit" class="button mainaction" tabindex="10" id="crear_NOOKbotton" onclick="return rcmail.command('send','',this,event)" value="CREAR" >
<input type="reset" class="button mainaction" tabindex="10" id="borrar_NOOKbotton" onclick="return rcmail.command('send','',this,event)" value="BORRAR" >
<input type="submit" class="button mainaction" tabindex="10" id="crear_NOOKbotton"value="CREAR" >
<input type="reset" class="button mainaction" tabindex="10" id="borrar_NOOKbotton"value="BORRAR" >
</div>
</form>
......
......@@ -435,8 +435,10 @@ label {
.comentarioTexto .usuario{
font-size-adjust: 0.8;
}
.comentarioTexto .usuario a{
padding-right: 2rem;
text-decoration: none;
}
.star1{
padding-left: 70%;
......@@ -720,4 +722,15 @@ margin:auto;
}
.pag-agregarDocumento{
margin-top: 2rem;
padding: 1rem;
background-color: #3DB000;
border-radius: 15px;
border: 10px;
width: 60%;
margin: auto;
margin: 2rem auto auto;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment