JSP: Récupèrer un champs dans une autre JSP
Bonjour,
Je n'arrive pas à récupérer en paramètre mon <input type="file" name="parcourir" size="40" value="file"/> dans mon autre JSP.
je fais bien un <%=request.getParameter("file")%> mais je récupère null
Voici ma JSP avec mes 2 input file:
Code:
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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Aide_Manager</title>
<link href='http://fonts.googleapis.com/css?family=Ubuntu+Condensed' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Marvel' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Marvel|Delius+Unicase' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Arvo' rel='stylesheet' type='text/css'>
<link href="style.css" rel="stylesheet" type="text/css" media="screen" >
</head>
<body>
<div id="wrapper">
<div id="wrapper2">
<div id="header" class="container">
<div id="logo">
<h1><a href="accueil.jsp">Aide <span>Manager</span></a></h1>
</div>
<div id="menu">
<ul>
<li class="current_page_item"><a href="accueil.jsp">Accueil</a></li>
<li><a href="alimenter.jsp">Alimenter les Fichiers Excels</a></li>
</ul>
</div>
</div>
<div id="banner"></div>
<!-- end #header -->
<div id="page">
<div id="content">
<div class="post">
<h2 class="title"><a href="#">Alimenter les Fichiers Excels </a></h2>
<div style="clear: both;"> </div>
<div class="entry">
<table>
<tr>
<td>1. Extract Hermes:</td>
<td class="cellule">
<input type="file" name="parcourir" size="40" value="file"/> </td>
</tr>
<tr>
<td colspan="1"></td>
<td class="centre">
<form action="Read_write.jsp">
<input type="submit" value="Valider" id="search-submit"/>
</form>
</td>
</tr>
<tr><td> </td><td> </td></tr>
<tr><td> </td><td> </td></tr>
<tr>
<td>2. Projection 2012:</td>
<td class="cellule">
<input type="file" name="parcourir" size="40"/>
</td>
</tr>
<tr>
<td colspan="1"></td>
<td class="centre">
<form action="Read_write2.jsp">
<input type="submit" value="Valider" id="search-submit"/>
</form>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="sidebar">
<ul>
<li>
<h2>Menu</h2>
<ul>
<li><a href="accueil.jsp">Accueil</a></li>
<li><a href="alimenter.jsp">Alimenter les Fichiers Excels</a></li>
</ul>
</li>
</ul>
</div>
<!-- end #sidebar -->
<div style="clear: both;"> </div>
</div>
<!-- end #page -->
<div id="footer">
<p>Copyright (c) 2012 <a href="http://www.gdfsuez.com">gdfsuez.com</a>. All rights reserved.</p>
</div>
</div>
</div>
<!-- end #footer -->
</body>
</html> |
Et voici ma JSP ou j'affiche le fichier choisi (en rouge):
Code:
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 50 51 52 53 54 55 56 57 58 59 60 61 62
|
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ page import="java.io.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Aide_Manager</title>
<link href='http://fonts.googleapis.com/css?family=Ubuntu+Condensed' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Marvel' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Marvel|Delius+Unicase' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Arvo' rel='stylesheet' type='text/css'>
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<div id="wrapper">
<div id="wrapper2">
<div id="header" class="container">
<div id="logo">
<h1><a href="accueil.jsp">Aide <span>Manager</span></a></h1>
</div>
<div id="menu">
<ul>
<li class="current_page_item"><a href="accueil.jsp">Accueil</a></li>
<li><a href="alimenter.jsp">Alimenter les Fichiers Excels</a></li>
</ul>
</div>
</div>
<div id="banner"></div>
<!-- end #header -->
<div id="page">
<div id="content">
<div class="post">
<h2 class="title"><a href="#">Alimenter les Fichiers Excels </a></h2>
<div style="clear: both;"> </div>
<div class="entry">
<p>Le Fichier <%=request.getParameter("file")%> a été correctement alimenter.</p> </div>
</div>
</div>
<div id="sidebar">
<ul>
<li>
<h2>Menu</h2>
<ul>
<li><a href="accueil.jsp">Accueil</a></li>
<li><a href="alimenter.jsp">Alimenter les Fichiers Excels</a></li>
</ul>
</li>
</ul>
</div>
<!-- end #sidebar -->
<div style="clear: both;"> </div>
</div>
<!-- end #page -->
<div id="footer">
<p>Copyright (c) 2012 <a href="http://www.gdfsuez.com">gdfsuez.com</a>. All rights reserved.</p>
</div>
</div>
</div>
<!-- end #footer -->
</body>
</html> |
J'ai oublié quelques chose... non ?