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 :

html:select fais planter mon tile sans erreur


Sujet :

Struts 1 Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Inscrit en
    Octobre 2008
    Messages
    14
    Détails du profil
    Informations forums :
    Inscription : Octobre 2008
    Messages : 14
    Par défaut html:select fais planter mon tile sans erreur
    Bonjour a tous et toutes,
    J'ai un petit soucis dont je n'arrive pas a trouver la solution

    Alors j'ai un formulaire, et je cherche a afficher un selectbox, qui affiche une propertie de ma liste, chose qui avait toujours marché sans trop forcé jusque la, et la je ne sais pas trop d'ou ca viens.

    Mon code action :
    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
     
    	/**
             * Met a jour la liste de variable globale.
             * @param request
             * @param aform
             * @throws DAOException
             * @throws GenericException
             */
    	public void majListeVariableGlobal(HttpServletRequest request, ActionForm aform) throws DAOException, GenericException
    	{
    		log.debug("Récupération de la liste des variables globales ..");
    		List<Variable> listeVarGlobal = new ArrayList<Variable>();
    		try
    		{
    			listeVarGlobal = mofacad.getVariables();
    		}
    		catch (GenericException e)
    		{
    			log.error("Erreur récupération liste variable - " + e.getMessage());
    			throw new GenericException("ErreurBase", e.getMessage());  
    		}
    		log.debug("On ajoute la liste de variable globale a la page");
    		((AdministrationProduitForm) aform).setListeVariableGlobale(listeVarGlobal);
    		((AdministrationProduitForm) aform).setListeVariableGlobal(listeVarGlobal);
    		log.debug("Liste variable récupérée et mise a jour ..");
    Ma code formulaire lié :
    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
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
     
    public class AdministrationProduitForm extends GenericForm {
    	//-----------------------------------------
    	private static final long	serialVersionUID	= 8736818772542508633L;
    	private static Log log;
    	private List<Variable> listeVariableGlobale;
    	private List<Variable> listeVariableGlobal;
    	private List<Variable> listeVariableProduit;
    	private int idVariableGlobaleSelect;
    	private String code;
    	private String libelleSelect;
    	private String codeSelect;
    	//-----------------------------------------
     
    	public AdministrationProduitForm()
    	{
    		super();
    		log = LogFactory.getLog(AbstractGenericDAO.class);
    		setListeVariableProduit(new ArrayList<Variable>());
    		setListeVariableGlobale(new ArrayList<Variable>());
    		setListeVariableGlobal(new ArrayList<Variable>());
    		setIdVariableGlobaleSelect(1);
    		setCode("");
    		setLibelleSelect("");
    		setCodeSelect("");
    	}
     
    	/**
             * @param listeVariableProduit the listeVariableProduit to set
             */
    	public void setListeVariableProduit(List<Variable> listeVariableProduit)
    	{
    		this.listeVariableProduit = listeVariableProduit;
    	}
     
    	/**
             * @return the listeVariableProduit
             */
    	public List<Variable> getListeVariableProduit()
    	{
    		return listeVariableProduit;
    	}
     
    	/**
             * @param listeVariableGlobale the listeVariableGlobale to set
             */
    	public void setListeVariableGlobale(List<Variable> listeVariableGlobale)
    	{
    		this.listeVariableGlobale = listeVariableGlobale;
    	}
     
    	/**
             * @return the listeVariableGlobale
             */
    	public List<Variable> getListeVariableGlobale()
    	{
    		return listeVariableGlobale;
    	}
     
    	/**
             * @param idVariableGlobaleSelect the idVariableGlobaleSelect to set
             */
    	public void setIdVariableGlobaleSelect(int idVariableGlobaleSelect)
    	{
    		this.idVariableGlobaleSelect = idVariableGlobaleSelect;
    	}
     
    	/**
             * @return the idVariableGlobaleSelect
             */
    	public int getIdVariableGlobaleSelect()
    	{
    		return idVariableGlobaleSelect;
    	}
     
    	/**
             * @param code the code to set
             */
    	public void setCode(String code)
    	{
    		this.code = code;
    	}
     
    	/**
             * @return the code
             */
    	public String getCode()
    	{
    		return code;
    	}
     
    	/**
             * @param libelleSelect the libelleSelect to set
             */
    	public void setLibelleSelect(String libelleSelect)
    	{
    		this.libelleSelect = libelleSelect;
    	}
     
    	/**
             * @return the libelleSelect
             */
    	public String getLibelleSelect()
    	{
    		return libelleSelect;
    	}
     
    	/**
             * @param codeSelect the codeSelect to set
             */
    	public void setCodeSelect(String codeSelect)
    	{
    		this.codeSelect = codeSelect;
    	}
     
    	/**
             * @return the codeSelect
             */
    	public String getCodeSelect()
    	{
    		return codeSelect;
    	}
     
    	/**
             * @param listeVariableGlobal the listeVariableGlobal to set
             */
    	public void setListeVariableGlobal(List<Variable> listeVariableGlobal)
    	{
    		this.listeVariableGlobal = listeVariableGlobal;
    	}
     
    	/**
             * @return the listeVariableGlobal
             */
    	public List<Variable> getListeVariableGlobal()
    	{
    		return listeVariableGlobal;
    	}
     
     
    }
    Mon code jsp :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
     
    <logic:notEmpty name="administrationProduitForm" property="listeVariableGlobal">
        <td>
         <html:select name="administrationProduitForm" property="idVariableGlobaleSelect" onchange="" >
         <html:optionsCollection property="code"/>                            
         </html:select>
        </td>
    </logic:notEmpty>
    <logic:empty name="administrationProduitForm" property="listeVariableGlobal">
     <td>
         <p>pas de liste !!!!</p>
     </td>
    </logic:empty>
    Voila en fait le logic:notEmpty fonctionne bien car si je met du texte il me l'affiche bien, mais dès que j'y met ma selectbox tout le tile plante et ainsi la page s'affiche sans son corp et surtout sans erreurs.

    Des idées ?

  2. #2
    Expert confirmé

    Femme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    5 793
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations forums :
    Inscription : Juillet 2005
    Messages : 5 793
    Par défaut
    Dans l'attribut property du tag html:optionsCollection, il faut y préciser une collection et non un String.

    C'est donc plutôt :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    <html:select property="idVariableGlobaleSelect">
         <html:optionsCollection property="listeVariableGlobal" value="code" label="code"/>                            
    </html:select>

  3. #3
    Membre averti
    Inscrit en
    Octobre 2008
    Messages
    14
    Détails du profil
    Informations forums :
    Inscription : Octobre 2008
    Messages : 14
    Par défaut
    Salut c_nvy merci de ton aide
    quand j'essaye ce code il me sort une erreur ..
    "Cannot find bean under name org.apache.struts.taglib.html.BEAN "
    même si je spécifie mon bean par name="administrationProduitForm"..

    Voici le details complet de l'erreur :
    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
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
     
    Type d'exception: javax.servlet.jsp.JspException 
    Servlet appelante: jsp 
    Page appelante: /KP1MoteurTarifaire/WEB-INF/jsp/administrationProduit/administrationProduit.jsp 
    Message d'erreur: javax.servlet.jsp.JspException: Cannot find bean under name org.apache.struts.taglib.html.BEAN 
    + Pile d'erreurs: 
     
    javax.servlet.jsp.JspException: Cannot find bean under name org.apache.struts.taglib.html.BEAN
    	at org.apache.struts.taglib.html.SelectTag.calculateMatchValues(SelectTag.java:240)
    	at org.apache.struts.taglib.html.SelectTag.doStartTag(SelectTag.java:200)
    	at org.apache.jsp.WEB_002dINF.jsp.administrationProduit.administrationProduit_005fcontenu_jsp._jspx_meth_html_005fselect_005f0(administrationProduit_005fcontenu_jsp.java:726)
    	at org.apache.jsp.WEB_002dINF.jsp.administrationProduit.administrationProduit_005fcontenu_jsp._jspx_meth_logic_005fnotEmpty_005f1(administrationProduit_005fcontenu_jsp.java:700)
    	at org.apache.jsp.WEB_002dINF.jsp.administrationProduit.administrationProduit_005fcontenu_jsp._jspService(administrationProduit_005fcontenu_jsp.java:178)
    	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
    	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
    	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:679)
    	at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:584)
    	at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:497)
    	at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:965)
    	at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:600)
    	at org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:99)
    	at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:135)
    	at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:760)
    	at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:892)
    	at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:462)
    	at org.apache.jsp.WEB_002dINF.jsp.commun.layout_jsp._jspx_meth_tiles_005finsert_005f3(layout_jsp.java:401)
    	at org.apache.jsp.WEB_002dINF.jsp.commun.layout_jsp._jspService(layout_jsp.java:177)
    	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
    	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
    	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:679)
    	at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:584)
    	at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:497)
    	at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:965)
    	at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:600)
    	at org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:99)
    	at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:135)
    	at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:760)
    	at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:892)
    	at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:462)
    	at org.apache.jsp.WEB_002dINF.jsp.administrationProduit.administrationProduit_jsp._jspx_meth_tiles_005finsert_005f0(administrationProduit_jsp.java:137)
    	at org.apache.jsp.WEB_002dINF.jsp.administrationProduit.administrationProduit_jsp._jspService(administrationProduit_jsp.java:79)
    	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
    	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
    	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:679)
    	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:461)
    	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:399)
    	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
    	at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
    	at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:398)
    	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:241)
    	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
    	at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
    	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
    	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
    	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
    	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
    	at java.lang.Thread.run(Thread.java:595)

  4. #4
    Expert confirmé

    Femme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    5 793
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations forums :
    Inscription : Juillet 2005
    Messages : 5 793
    Par défaut
    Le html:select doit être dans un tag html:form.

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

Discussions similaires

  1. Réponses: 1
    Dernier message: 01/02/2013, 13h29
  2. Réponses: 2
    Dernier message: 27/04/2009, 13h09
  3. [DOM] Mon code javascript s'arrete sans erreur.. (GetElementByID)
    Par Titi41 dans le forum Général JavaScript
    Réponses: 12
    Dernier message: 30/06/2008, 10h52
  4. Mon code sans erreurs mais ne marche pas
    Par acacia dans le forum C
    Réponses: 49
    Dernier message: 25/01/2008, 16h38
  5. Réponses: 1
    Dernier message: 20/04/2007, 09h37

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