Bonjour,
J'ai realisé une applic web (JSP,Servlet...) sous sun one studio. j'ai une balise (personnalisée) sans corps qui realise un affichage dans la langue choisie précédement. Cela fonctionne en utilisant la technique des bundles.
En local (tomcat de sun one) tout fonctionne parfaitement... Voici le code de la balise :
Mais lorsque je porte mon applic sur un tomcat distant il ne trouve plus les fichier properties associés a chaque langue...du coup aucun label ne s'affiche. Actuellement mes fichiers properties sont placés dans: webdev/WEB-INF/lib
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 public class GoTag extends BodyTagSupport { private String cible; private boolean arret; private static final String NOM_GEN_FICHIER_PROPERTIES = "Languages"; public GoTag() { super(); arret = false; } (.......) public void writeTagBodyContent(JspWriter out, BodyContent bodyContent) throws IOException { String local_Langue="fr"; String local_Pays="FR"; if(pageContext.getAttribute("LangueChoisie").equals("Français")) { local_Langue = "fr"; local_Pays = "FR"; } else { if(pageContext.getAttribute("LangueChoisie").equals("English")) { local_Langue = "us"; local_Pays = "US"; } else { if(pageContext.getAttribute("LangueChoisie").equals("Nederlands")) { local_Langue = "nl"; local_Pays = "NL"; } } } Locale localCourant = new Locale(local_Langue,local_Pays); ResourceBundle res = ResourceBundle.getBundle(NOM_GEN_FICHIER_PROPERTIES,localCourant); try { pageContext.getOut().println(res.getString(cible)); } catch(IOException ioe) {} bodyContent.writeOut(out); bodyContent.clearBody(); } public void handleBodyContentException(Exception ex) throws JspException { throw new JspException("error in GoTag: " + ex); } public int doAfterBody() throws JspException { try { BodyContent bodyContent = getBodyContent(); JspWriter out = bodyContent.getEnclosingWriter(); writeTagBodyContent(out, bodyContent); } catch (Exception ex) { handleBodyContentException(ex); } if (theBodyShouldBeEvaluatedAgain()) { return EVAL_BODY_AGAIN; } else { return SKIP_BODY; } } public boolean theBodyShouldBeEvaluatedAgain() { return false; } }
Si quelqu'un sait où il faut placer mes fichiers properties afin qu'il soit disponible pour ma balise (appele dans mon JSP).....
Merci d'avance
[Modéré par Didier] : ajout de tag dans le titre - Les règles du forum Java
Partager