champ caché action - HTML/CSS - Programmation
Marsh Posté le 20-07-2005 à 12:00:51
Euh poste ton code, au cas ou ... mais je crois que c'est un problème de connaissances en JSP dans ton cas ^^'
Marsh Posté le 20-07-2005 à 12:26:42
FIchier include qui fonctionne avec action SimpleUpLoad sans non 
 
<html> 
<%@ page language="java" import="javazoom.upload.*,java.util.*" %> 
<%@ page errorPage="ExceptionHandler.jsp" %> 
 
<jsp:useBean id="upBean" scope="page" class="javazoom.upload.UploadBean" > 
  <jsp:setProperty name="upBean" property="folderstore" value="D Meta4/M4WS/fotos"/>
Meta4/M4WS/fotos"/> 
</jsp:useBean> 
 
<head> 
<title>Samples : Simple Upload</title> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
</head> 
<body bgcolor="#FFFFFF" text="#000000"> 
<ul class="style1"> 
<% 
 
      if (MultipartFormDataRequest.isMultipartFormData(request)) 
      { 
         // Uses MultipartFormDataRequest to parse the HTTP request. 
         MultipartFormDataRequest mrequest = new MultipartFormDataRequest(request); 
   //out.println(request); 
         String todo = null; 
   String temp = null; 
   String afterdot = null; 
         if (mrequest != null) {todo = mrequest.getParameter("todo" );out.println("tododo"+todo);} 
      if ( (todo != null) && (todo.equalsIgnoreCase("upload" )) ) 
      { 
                Hashtable files = mrequest.getFiles(); 
                if ( (files != null) && (!files.isEmpty()) ) 
                { 
     //addUploadListener(UploadListener listener); 
                    UploadFile file = (UploadFile) files.get("uploadfile" ); 
     UploadFile filesto = (UploadFile) files.get("filestocke" ); 
 
                    if (file != null)  
     { 
         temp = file.getFileName(); 
     	String filestof = file.getFileName(); 
       out.println("dfjskdjfoisjdfslj "+filestof); 
     	int pos = temp.indexOf("." ); 
     	// verify there is a dot 
     	if (pos != -1){} 
     	// length of the file name to verify if after the dot there is only gif jpeg jpg 
     	int len = temp.length(); 
     	afterdot = temp.substring(pos+1,len); 
      
     	//out.println(afterdot); a transformer uppercase 
     	if (afterdot.equals("GIF" ) || afterdot.equals("jpeg" )|| afterdot.equals("jpg" )) 
     	{  
       //out.println("<li>Form field : uploadfile"+"<BR> Uploaded file : "+file.getFileName()+"("+file.getFileSize()+" bytes)"+"<BR> Content Type : "+file.getContentType()); 
       upBean.store(mrequest, "uploadfile" ); 
     	}  
     	else  
     	{ 
 
     	%> 
     	<script type="text/javascript" language="Javascript1.5"> 
       alert("Select a file ending by jpeg jpg or gif" );    
     	</script> 
     	<%} 
                    // Uses the bean now to store specified by jsp:setProperty at the top. 
                     
     } 
                } 
                else 
                { 
                  System.out.println("<li>No uploaded files" ); 
                } 
      } 
         else out.println("<BR> todo="+todo); 
      } 
%> 
</ul> 
<form method="post" action="SimpleUpLoad.jsp" name="upform" enctype="multipart/form-data"> 
  <table width="60%" border="0" cellspacing="1" cellpadding="1" align="center" class="style1"> 
    <tr> 
      <td align="left"><b> Select a file to upload :</b></td> 
    </tr> 
    <tr> 
      <td align="left"> 
        <input type="file" name="uploadfile" size="30"> 
        </td> 
    </tr> 
 <tr> 
    <td align="left"> 
        <input type="file" name="filestocke" size="30"> 
       </td> 
    </tr> 
    <tr> 
      <td align="left"> 
 	<input type="hidden" name="todo" value="upload"> 
        <input type="submit" name="Submit" value="Upload"> 
        <input type="reset" name="Reset" value="Cancel"> 
        </td> 
    </tr> 
  </table> 
  <br> 
  <br> 
 
Fichiermere (extrait) 
peut etre que c'est à cause des request comme il y en a ds fichier mere 
 
<!DOCTYPE html  
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "DTD/xhtml1-transitional.dtd"> 
<html> 
<head><%@ page  import="com.meta4.session.*, com.meta4.m4operations.*" %> 
<%@ page import="com.meta4.configuration.*" %> 
<title>ESS Portal</title> 
<link href="/css/estilo_sse.css" type="text/css" rel="stylesheet" /> 
 
 
 M4SessionCl zsesion = M4Context.getM4SessionCl(request);  
    String estado = request.getParameter("estado" ); 
 String zlang = request.getParameter("lang" ); 
 if (zlang!=null){ 
 zsesion.putBagEntries("lang",zlang); 
 } 
 if ((estado==null)||(estado.equals("" ))){estado="0";} 
 String zsubsesion = "SSE_INICIO"; 
 String zMeta4Object = "SSE_INICIO"; 
 String znodo = "SSE_INICIO"; 
 
// Normally not modified. 
 
   String zoutputdef = zsubsesion + "!" + znodo + "
   String zlectura = zsubsesion + "!" + znodo; 
   String zraiz = zsubsesion + "!" + znodo + "."; 
 
// Generic Meta4Object load method 
 
   String zmetodocarga = zsubsesion + "!SSE_INICIO.CARGA"; 
    
// Items to be loaded. You must add all of the ones that you want to view. 
 
   String zENLACE = zraiz + "ENLACE"; 
   String zNENLACE = zraiz + "N_ENLACE"; 
   String zNOMBRE = ""; 
   String zMAILWEBMASTER = ""; 
   String zMAILRRHH = ""; 
   String zSTDIDPERSON = ""; 
   String zIS_KNOWNET = ""; 
%> 
 
 .....} else { 
protocolo="https://"; 
} 
String Total_Server_Knownet = protocolo+Server_Peoplenet+":"+Port_Peoplenet+Servlet_local+"?_PROVIDER="+aux_provider; 
try { 
 	M4Operations Introduccion2 = new M4Operations(request); 
 	zNOMBRE = Introduccion2.getItem(znodo,zMeta4Object,znodo,"","NOMBRE" ); 
 	zMAILWEBMASTER = Introduccion2.getItem(znodo,zMeta4Object,znodo,"","MAIL_WEBMASTER" ); 
 	zMAILRRHH = Introduccion2.getItem(znodo,zMeta4Object,znodo,"","MAIL_RRHH" ); 
 	zSTDIDPERSON = Introduccion2.getItem(znodo,zMeta4Object,znodo,"","STD_ID_PERSON" ); 
 	zsesion.putBagEntries("minombre",zNOMBRE); 
 	zsesion.putBagEntries("mailrrhh",zMAILRRHH); 
 	zsesion.putBagEntries("zIdPerson",zSTDIDPERSON);   
 	zsesion.putBagEntries("mailwebmaster",zMAILWEBMASTER); 
 	zsesion.putBagEntries("IsKnownet",zIS_KNOWNET); 
 	zsesion.putBagEntries("Total_Server_Knownet",Total_Server_Knownet); 
 	zsesion.putBagEntries("aux_provider",aux_provider); 
} catch(Exception e) {} 
 
int zTab=12; 
%> 
<script type="text/javascript" language="Javascript1.5"> 
var sIsKnownet = "<%=zIS_KNOWNET%>"; 
var sTotal_Server_Knownet = "<%=Total_Server_Knownet%>"; 
</script> 
<%@ include file="../../sse_generico/english/menu_ess.jsp" %> 
<<%@ include file="generico_portal_links.jsp" %> 
</div> 
<div id="capa_cuerpo" style="position:relative; left:21%; top:110px; width:79%; z-index:2"> 
<table width="100%" cellspacing="0"> 
<tr><td class="titulofuncional" colspan="2">Employee Self-Service</td></tr> 
<tr> 
 <td class="descripcionfuncional">Use the modules in this application to manage your personal, financial, and professional information. </td> 
</tr> 
</table> 
<br /> 
<table width="100%" cellspacing="0"><tr><td> 
<table width="100%" cellspacing="0"> 
<tr> 
 <td colspan="2" class="fuentetitulomenu" id="K1" onmouseover=writehelp(id) onmouseout=writehelp(0)>My Personal Information</td><!--  --> 
 <td width="30%"></td> 
</tr> 
<tr> 
 <td colspan="2"  class="tablamenuleft"><hr class="barramenu" /></td> 
 <td width="30%"></td> 
<%@ include file="../../sse_generico/english/SimpleUpLoad.jsp" %>  
Marsh Posté le 20-07-2005 à 13:14:07
Mouais ...  
 
Les ../ c'est pas conseillé quand tu fais des includes ... 
 
Le code en table, c'est plus aux normes et c'est difficile à lire... 
 
Tu n'as pas mis ton code entre balises [code ][ /code] ... 
 
Comme c'est vraiment un problème JSP à mon avis, t'auras pas des masses de réponses dans cette catégorie ... Essaies Java plutot 
Marsh Posté le 20-07-2005 à 11:57:25
Bonjour
en faisant un upLoad avec bean jsp et html je recupere un valeur d'un champ caché de mon formulaire, je n'arrive pas à la recuperer quand j'insere mon code ds une autre page avec une action="Fichiermere.jsp" (il y a qu'un seul formulaire pourtant)
Mais quand j'utilise un include pour le fichierinclude avec un form qui contient action="Fichierinclude.jsp" alors ca marche.
Aussi j'ai remarque que sans mettre action "" ca marche pas
Ca vient de la propriete ection du form ou de MultipartFormDataRequest.isMultipartFormData(request)