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 d'affichage dans une JSP


Sujet :

Struts 1 Java

  1. #1
    Membre régulier
    Homme Profil pro
    Développeur Java
    Inscrit en
    Mars 2007
    Messages
    163
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 54
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Activité : Développeur Java
    Secteur : Industrie

    Informations forums :
    Inscription : Mars 2007
    Messages : 163
    Points : 90
    Points
    90
    Par défaut Problème d'affichage dans une JSP
    Bonjour,

    Je tente depuis plusieurs jours de remédier à un problème et ne trouve toujours pas...

    J'ai une simple 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
     
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <html:html>
    <head>
    <title>Struts Blank Application</title>
    <html:base/>
    </head>
    <body>
     
    <!--h3>Welcome!</h3-->
    <h3><bean:message key="welcome.heading"/></h3>
     
    </body>
    </html:html>
    Notez que je n'ai pas mis l'attribut locale="true" dans la balise <html:html>

    Mes fichiers MessageResources.properties et MessageResources_fr.properties sont bien dans /src (ils apparaissent bien dans WEB-INF/classes/java) :

    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
     
    # -- standard errors --
    errors.header=<UL>
    errors.prefix=<LI>
    errors.suffix=</LI>
    errors.footer=</UL>
    # -- validator --
    errors.invalid={0} is invalid.
    errors.maxlength={0} can not be greater than {1} characters.
    errors.minlength={0} can not be less than {1} characters.
    errors.range={0} is not in the range {1} through {2}.
    errors.required={0} is required.
    errors.byte={0} must be an byte.
    errors.date={0} is not a date.
    errors.double={0} must be an double.
    errors.float={0} must be an float.
    errors.integer={0} must be an integer.
    errors.long={0} must be an long.
    errors.short={0} must be an short.
    errors.creditcard={0} is not a valid credit card number.
    errors.email={0} is an invalid e-mail address.
    # -- other --
    errors.cancel=Operation cancelled.
    errors.detail={0}
    errors.general=The process did not complete. Details should follow.
    errors.token=Request could not be completed. Operation is not in sequence.
    # -- welcome --
    welcome.title=Struts Blank Application
    welcome.heading=Welcome!
    Dans le fichier struts-config.xml, j'ai bien :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
     <message-resources parameter="MessageResources" />
    Le web.xml :
    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
     
    <?xml version="1.0" encoding="ISO-8859-1"?>
     
      <!DOCTYPE web-app PUBLIC
    	"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    	"http://java.sun.com/dtd/web-app_2_3.dtd">
     
    <web-app>
      <servlet>
        <servlet-name>action</servlet-name>
        <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
        <init-param>
          <param-name>config</param-name>
          <param-value>/WEB-INF/struts-config.xml</param-value>
        </init-param>
        <load-on-startup>2</load-on-startup>
     </servlet>
     
     
      <!-- Standard Action Servlet Mapping -->
      <servlet-mapping>
        <servlet-name>action</servlet-name>
        <url-pattern>*.do</url-pattern>
      </servlet-mapping>
     
     
      <!-- The Usual Welcome File List -->
      <welcome-file-list>
        <welcome-file>/pages/index.jsp</welcome-file>
      </welcome-file-list>
     
    	<taglib>
    	  	<taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
    		<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
    	</taglib>
    	<taglib>
    	  	<taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
    		<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
    	</taglib>
    	<taglib>
    	  	<taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
    		<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
    	</taglib>
    </web-app>
    Malheureusement, malgré des essais dans tous les sens, j'ai toujours cette énervante 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
     
    javax.servlet.ServletException: Missing message for key "welcome.heading" in bundle "(default bundle)" for locale fr
    	org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
    	org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
    	org.apache.jsp.pages.Welcome_jsp._jspService(Welcome_jsp.java:79)
    	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
    	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
    	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    	org.apache.struts.chain.commands.servlet.PerformForward.handleAsForward(PerformForward.java:99)
    	org.apache.struts.chain.commands.servlet.PerformForward.perform(PerformForward.java:82)
    	org.apache.struts.chain.commands.AbstractPerformForward.execute(AbstractPerformForward.java:51)
    	org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:48)
    	org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
    	org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
    	org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
    	org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:280)
    	org.apache.struts.action.ActionServlet.process(ActionServlet.java:1858)
    	org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:446)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    Si quelqu'un pouvait m'aider... J'en ai vraiment marre de tourner en rond...

  2. #2
    Expert éminent

    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
    Points : 7 778
    Points
    7 778
    Par défaut
    Tu dis que les fichiers properties sont sous WEB-INF/classes/java.
    Tu les as donc mis dans un package que tu as appelé java.

    Il faut donc le spécifier dans la balise message-resources du struts-config.xml :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <message-resources parameter="java.MessageResources" />
    Modératrice Java - Struts, Servlets/JSP, ...

  3. #3
    Membre régulier
    Homme Profil pro
    Développeur Java
    Inscrit en
    Mars 2007
    Messages
    163
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 54
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Activité : Développeur Java
    Secteur : Industrie

    Informations forums :
    Inscription : Mars 2007
    Messages : 163
    Points : 90
    Points
    90
    Par défaut
    Ca marche, enfin !

    C'était tout simplement ça...

    Merci beaucoup !

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

Discussions similaires

  1. Problème d'affichage dans une JSP
    Par goomie dans le forum Servlets/JSP
    Réponses: 0
    Dernier message: 22/12/2011, 11h37
  2. Problème d'affichage dans une JSP
    Par bitter00 dans le forum Servlets/JSP
    Réponses: 4
    Dernier message: 26/09/2011, 15h17
  3. Problème d'affichage dans une page JSP
    Par lbrnoss dans le forum Servlets/JSP
    Réponses: 3
    Dernier message: 13/02/2011, 14h31
  4. Affichage dans une jsp
    Par techtonyc dans le forum Servlets/JSP
    Réponses: 5
    Dernier message: 07/03/2007, 11h30
  5. Problème d'affichage dans une zone de "dessin"
    Par jason69 dans le forum AWT/Swing
    Réponses: 7
    Dernier message: 28/08/2006, 16h12

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