JSP (Java Server Page) - Ayuda con JSP

 
Vista:
sin imagen de perfil
Val: 1
Ha mantenido su posición en JSP (Java Server Page) (en relación al último mes)
Gráfica de JSP (Java Server Page)

Ayuda con JSP

Publicado por David (1 intervención) el 17/05/2019 21:14:17
Hola a todos, tengo un problema que no es me posible, tengo el siguiente codigo en JSP y l que pretendo es hacer lo siguiente:
Seleccionar una opcion y que al momento de presionar el boton guardar aparezca la informacion, ejemplo, selecciono una opcion y que al momento de presionar guardar aparezca una imagen

Este es el index.jsp

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>SUBIR ARCHIVO AL SERVIDOR</title>
    </head>
    <body>
        <form action="uploadfile.jsp" method="post" enctype="multipart/form-data">
 
    <center>
   <table border="2">
       <tr>
	       <td align="center"><b>Turnos de Fin de Semana</td>
	   </tr>
       <tr>
            <table align="left">
	       <td>
 
		       <select id="Supervior" name="Supervisor">
 
                            <option value="1">Patricio Silva</option>
                            <option value="2">Cristian Yañez</option>
 
                        </select>
 
		   <td>
                       </table>
	   </tr>
	   <tr>
	      <td>
		     <select id="Informatica" name="Informatica">
                            <option value="1">Claudio Aguilera</option>
                            <option value="2">David Olave</option>
                            <option value="3">Ariel Muñoz</option>
 
       </select>
		  </td>
 
		 <tr>
		    <td align="center">
               <input type="submit" name="Submit" value="Guardar"/>
			</td>
		 </tr>
    </table>
 
        </form>
    </body>
</html>


El otro archivo

<%@ page import="java.util.List" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.io.File" %>
<%@ page import="org.apache.commons.fileupload.servlet.ServletFileUpload"%>
<%@ page import="org.apache.commons.fileupload.disk.DiskFileItemFactory"%>
<%@ page import="org.apache.commons.fileupload.*"%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<center>
<table border="2">
<tr>
<td>
<h1>Your files uploaded </h1>
</td>
</tr>
<%
boolean isMultipart = ServletFileUpload.isMultipartContent(request);
if (!isMultipart) {
} else {
FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
List items = null;
try {
items = upload.parseRequest(request);
} catch (FileUploadException e) {
e.printStackTrace();
}
Iterator itr = items.iterator();
while (itr.hasNext()) {
FileItem item = (FileItem) itr.next();
if (item.isFormField()) {
} else {
try {
String itemName = item.getName();
File savedFile = new File(config.getServletContext
().getRealPath("/")+"uploadedFiles/"+itemName);
item.write(savedFile);
out.println("<tr><td><b>Your file has been saved at the loaction:</b></td></tr><tr><td><b>"+config.getServletContext().getRealPath
("/")+"uploadedFiles"+"\\"+itemName+"</td></tr>");
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
%>
</table>
</center>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder