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

Struts 1 Java Discussion :

Problème Struts- Cannot find bean: "mfCode" in any scope


Sujet :

Struts 1 Java

  1. #1
    Nouveau membre du Club
    Inscrit en
    Avril 2006
    Messages
    59
    Détails du profil
    Informations personnelles :
    Âge : 43

    Informations forums :
    Inscription : Avril 2006
    Messages : 59
    Points : 38
    Points
    38
    Par défaut Problème Struts- Cannot find bean: "mfCode" in any scope
    Bonsoir à tous,


    Je souhaiterai afficher une popup m'affichant les types de moyens associés à un moyen.
    Le problème, c'est que j'ai le message d'erreur indiqué dans le titre ci-dessous. Apparemment, si j'ai bien compris, il ne me trouve pas le bean associé à cette variable.
    J'ai beau cherché dans la jsp, le formulaire et dans struts-config.xml, je ne vois pas l'erreur. Les variables utilisées ont l'air d'être les mêmes partout.

    Pour plus de clarté, voici le code de ma jsp :
    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
    68
    69
    70
    71
    72
    73
     
    <html:form  action="<%=action%>" onsubmit="return submitPage1();">
     
    	<html:hidden property="typTmId" value="<%=typeMoyenId%>"></html:hidden> 
    	<html:hidden property="timeId" value="<%=sdf2.format(date)%>"></html:hidden> 
     
    	<table border="1"  width="500" cellpadding="3" cellspacing="0" bordercolor="#AABFFF">
     
    		<tr>
    			<!-- Traitement des code, libelle et commentaire -->
    	      	<td>CODE</td>
     
    	      	<%if ((moyenFixeTO!=null) && (moyenFixeTO.getMfCode()!=null)) {
    	      		if (moyenFixeTO.getMfId()!=null) { %>
     
    		      	<td><html:text name="mfCode" size="20" maxlength="20" onfocus="focusOnInput()" onblur="focusOutInput()" property="mfCode" value="<%=moyenFixeTO.getMfCode()%>"/>
    		      		<html:errors property="mfCode"/>
    		      	</td>
     
    		      	<%} else { %>
     
    				<td align="left"><input type="text" class="zoneSaisiRO" readonly="readonly" name="mfCode" value="<%=moyenFixeTO.getMfCode()%>"/>
    				<html:hidden property="mfCode" value="<%=moyenFixeTO.getMfCode()%>"></html:hidden> 
     
    				<% }
    	      	}else{ %>
    				<td><html:text name="mfCode" size="20" maxlength="20" onfocus="focusOnInput()" onblur="focusOutInput()" property="mfCode"/>
    		      		<html:errors property="mfCode"/>
    		      	</td>	      		
    	      	<%} %>
    	     </tr>
     
    	     <tr>
    	      	<td>LIBELLE</td>
     
    	      	<%if ((moyenFixeTO!=null) && (moyenFixeTO.getMfLibelle()!=null)) { %>
    		      	<td><html:text name="mfLibelle" size="20" maxlength="80" onfocus="focusOnInput()" onblur="focusOutInput()"property="mfLibelle" value="<%=moyenFixeTO.getMfLibelle()%>"/>
    		      		<html:errors property="mfLibelle"/>
    		      	</td>
    	      	<%}else{ %>
    				<td><html:text name="mfLibelle" size="20" maxlength="80" onfocus="focusOnInput()" onblur="focusOutInput()"property="mfLibelle"/>
    		      		<html:errors property="mfLibelle"/>
    		      	</td>	      		
    	      	<%} %>
     
    		</tr>
     
    	     <tr>
    	      	<td>COMMENTAIRE</td>
     
    	      	<%if ((moyenFixeTO!=null) && (moyenFixeTO.getMfComment()!=null)) { %>
    		      	<td><html:textarea name="mfComment" onfocus="focusOnInput()" onblur="focusOutInput()" cols="20" rows="15" property="mfComment" value="<%=moyenFixeTO.getMfComment()%>"/>
    		      		<html:errors property="mfComment"/>
    		      	</td>
    	      	<%}else{ %>
    				<td><html:textarea name="mfComment" onfocus="focusOnInput()" onblur="focusOutInput()" cols="20" rows="15" property="mfComment"/>
    		      		<html:errors property="mfComment"/>
    		      	</td>	      		
    	      	<%} %>
     
    		</tr>
    	</table>
     
    	<table border="0" align="center">
     
    		<tr>					
    			<td><input type="image" src="<% if ((moyenFixeTO==null) || (moyenFixeTO.getMfId()==0)) {%>images/btAjout.jpg<%} else {%>images/btModifier.jpg<%}%>" class="shadeInput"></td>
    			<td><a href="#" onclick="javascript:window.close()"><img border="0" src="images/btAnnuler.jpg"/></a></td>
    		</tr>
     
    	</table>
     
    </html:form>
    celui de mon formulaire :
    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
     
    public class MoyenFixePopupForm extends ActionForm {
     
    	/**
             * 
             */
    	private static final long serialVersionUID = 1L;
    	private String mfId="";//Id de moyen fixe
                 private String mfCode="";
    	private String mfLibelle="";
    	private String mfComment="";
     
                public String getMfCode() {
    		return mfCode;
    	}
    	public void setMfCode(String mfCode) {
    		this.mfCode = mfCode;
    	}
    	public String getMfComment() {
    		return mfComment;
    	}
    	public void setMfComment(String mfComment) {
    		this.mfComment = mfComment;
    	}
    	public String getMfLibelle() {
    		return mfLibelle;
    	}
    	public void setMfLibelle(String mfLibelle) {
    		this.mfLibelle = mfLibelle;
    	}
    	public String getMfId() {
    		return mfId;
    	}
    	public void setMfId(String mfId) {
    		this.mfId = mfId;
    	}
    ....
    et enfin pour finir, mon struts-config

    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
     
    <form-bean
    		name="moyenFixePopupForm" type="logistique.forms.MoyenFixePopupForm">
    	</form-bean>
     
    <action
    		path="/MoyenFixePopupAction"
    		type="org.springframework.web.struts.DelegatingActionProxy"
    		name="moyenFixePopupForm"
    		input="/WEB-INF/jsp/logistique/AddMoyenFixePopup.jsp"
    		scope="request"
    		parameter="methode"
    		validate="false">
     
    		<forward name="displayPage" path="/WEB-INF/jsp/logistique/AddMoyenFixePopup.jsp"></forward>
    		<forward name="succes" path="/WEB-INF/jsp/void.jsp"></forward>
     
    	</action>
    j'ai bien cherché sur le forum si quelqu'un avait le même problème que moi, mais apparemment, ce n'est pas vraiment le cas.
    J'espère que ces éléments seront suffisants pour que quelqu'un comprenne le problème.

    Merci d'avance pour votre retour.

    Bonne soirée

  2. #2
    Membre expérimenté Avatar de willoi
    Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2006
    Messages
    1 355
    Détails du profil
    Informations personnelles :
    Âge : 51
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Décembre 2006
    Messages : 1 355
    Points : 1 639
    Points
    1 639
    Par défaut
    fais voir le code de MoyenFixePopupAction

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    <html:text name="mfCode" size="20" maxlength="20" onfocus="focusOnInput()" onblur="focusOutInput()" property="mfCode"/>
    Apres ce genre de syntaxe est bizarre, tu mets la meme chose comme nom de ton objet et de ta propriete (name et property).

    Comment s'appelle ton objet que tu as mis en request ou en session?

  3. #3
    Nouveau membre du Club
    Inscrit en
    Avril 2006
    Messages
    59
    Détails du profil
    Informations personnelles :
    Âge : 43

    Informations forums :
    Inscription : Avril 2006
    Messages : 59
    Points : 38
    Points
    38
    Par défaut
    en fait, c'est vraiment stupide de ma part, j'avais pas mis de value dans la jsp, au niveau de la ligne pour l'ouverture de la popup en création !

    maintenant, ça marche mieux !

    désolé pour le dérangement !!

    bonne soirée et merci à toi willoi pour avoir essayé de m'aider !!

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

Discussions similaires

  1. [Struts 1.3] cannot find bean
    Par touftouf57 dans le forum Struts 1
    Réponses: 3
    Dernier message: 12/06/2009, 19h06
  2. Problème : Cannot find bean
    Par Incinerator dans le forum Débuter avec Java
    Réponses: 6
    Dernier message: 09/10/2008, 16h36
  3. Réponses: 2
    Dernier message: 09/08/2007, 16h36

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