IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Servlets/JSP Java Discussion :

Transmettre un param d'une JSP vers servlet


Sujet :

Servlets/JSP Java

  1. #1
    Invité
    Invité(e)
    Par défaut Transmettre un param d'une JSP vers servlet
    salut
    j'ai un problem au niveau de ma jsp.. j'arrive pas a transmettre un paramètre a ma servlet

    le code de ma servlet:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    	pageEncoding="ISO-8859-1"%>
    	<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    	<jsp:useBean id="commandeExped" class="com.project.beans.CommandeExped"></jsp:useBean>
    	<jsp:useBean id="produitService" class="com.project.service.ProduitService"></jsp:useBean>
    	<jsp:useBean id="commandeExpedService" class="com.project.service.CommandeExpedService"></jsp:useBean>
     
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Modification d'une commande</title>
    <link type="text/css" rel="stylesheet" href="<c:url value="/css/style.css"/>" />
    </head>
    <body>
    	<div>
    		<form method="get" action="<c:url value="/modificationCommandeExped"/>">
     
    		<fieldset>
    				<legend>Modification d'une commande</legend>
     
    				<label for="clientCommande">Client </label>
    				<input type="text" id="client" name="clientCommande" value="<c:out value="${commandeExpedService.findById(param['idCommandeMod']).client.nom} ${commandeExpedService.findById(param['idCommandeMod']).client.prenom} "/>" size="30" maxlength="30" disabled/>
    				<br />				
    				<label for="produit">Produit <span class="requis">*</span></label>
    				<div id="produits">
    						<select  name="listeProduits" id="listeProduits" size="5" >
    							<option value="${commandeExpedService.findById(param['idCommandeMod']).produit.idProduit}" selected>${commandeExpedService.findById(param['idCommandeMod']).produit.description}</option>
     
    							<%-- Boucle sur la liste des produits --%>
    							<c:forEach items="${ produitService.findAll() }" var="produits">
    							<c:if test="${ produits.idProduit != commandeExpedService.findById(param['idCommandeMod']).produit.idProduit }">
    								<%--  L'expression EL ${ produits.description } permet de cibler la desc de  l'objet Produit stocké dans la liste--%>
    								<option value="${ produits.idProduit }">${produits.description }</option>
    								</c:if>
    							</c:forEach>
    						</select>						
    				</div>
    				<br /> 	
    				<label for="quantite">Quantité <span class="requis">*</span></label> 
    				<input type="text" id="quantite" name="quantite" value="<c:out value="${commandeExpedService.findById(param['idCommandeMod']).quantite}"/>"	size="30" maxlength="30" /> <span class="erreur">${form.erreurs['quantite']}</span>					
    				<br />	
    				<label for="montantCommande">Montant <span class="requis">*</span></label> 
    				<input type="text" id="montantCommande" name="montantCommande" value="<c:out value="${commandeExpedService.findById(param['idCommandeMod']).montant}"/>"	size="30" maxlength="30" disabled /> <span class="erreur">${form.erreurs['montantCommande']}</span>
    				<br /> 
    				<label for="dateCommande">Date <span class="requis">*</span></label>
    				<input type="text" id="dateC" name="dateCommande" value="<c:out value="${commandeExpedService.findById(param['idCommandeMod']).date}"/>" size="30" maxlength="30" disabled />
    				<br />
    				<label for="dateExped">Date de livraison <span class="requis">*</span></label>
    				<input type="text" id="dateE" name="dateExped" value="<c:out value="${commandeExpedService.findById(param['idCommandeMod']).dateExped}"/>" size="30" maxlength="30"  /> <span class="erreur">${form.erreurs['dateExped']}</span>
    				<br /> 
    				<label for="statutLivraison">Livraison prise en charge ?</label> 
    				<input type="radio" id="choixLivraison"	name="choixLivraison" value="oui"  /> Oui
    				<input type="radio" id="choixLivraison" name="choixLivraison" value="non" checked/> Non <br /><br />
    				<br />
     
    				<a href="<c:url value="/modificationCommandeExped">	<c:param name="paramName" value="paramValue"/></c:url>"></a><br/>
     
     
    		</fieldset>
     
    			<input class="bouton" type="submit" value="Valider" /> <input class="bouton" type="reset" value="Remettre à zéro" /> <br />
    		</form>
     
    		</div>
    </body>
    </html>
    la ligne en question est :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <a href="<c:url value="/modificationCommandeExped">	<c:param name="paramName" value="paramValue"/></c:url>"></a><br/>

    merci d'avance..

  2. #2
    Expert éminent sénior
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 481
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 481
    Points : 48 806
    Points
    48 806
    Par défaut
    tu obtiens quoi comme résultat dans ton html dans le browser avec cette ligne?

  3. #3
    Invité
    Invité(e)
    Par défaut
    Citation Envoyé par tchize_ Voir le message
    tu obtiens quoi comme résultat dans ton html dans le browser avec cette ligne?
    j obtiens mon formulaire.. quand j clic sur le bouton valider le paramètre "paramname" n'est pas ajouter a l'URL avec les autres param du formulaires

  4. #4
    Expert éminent sénior
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 481
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 481
    Points : 48 806
    Points
    48 806
    Par défaut
    j'aimerais voir ce html généré

  5. #5
    Invité
    Invité(e)
    Par défaut
    Citation Envoyé par tchize_ Voir le message
    j'aimerais voir ce html généré
    j'ai contourné le prblm en ajoutant un champ a mon formulaire avec l option readonly ( comme ça le valeur du paramètre est affiche mais pas modifiable )

    merci comme mm

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 0
    Dernier message: 26/06/2010, 21h38
  2. Réponses: 3
    Dernier message: 01/07/2009, 18h55
  3. Réponses: 13
    Dernier message: 30/03/2007, 15h52
  4. [Debutant] Données nulles de JSP vers Servlet method Post
    Par tck-lt dans le forum Servlets/JSP
    Réponses: 6
    Dernier message: 18/12/2006, 11h53
  5. Transfert d'un objet d'une JSP vers une Servlet
    Par biohazard dans le forum Servlets/JSP
    Réponses: 7
    Dernier message: 21/06/2004, 16h51

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo