Appel d'un fichier html se trouvant dans un jar

pradayrolus Messages postés 4 Date d'inscription mercredi 28 décembre 2005 Statut Membre Dernière intervention 6 février 2006 - 3 févr. 2006 à 15:12
Twinuts Messages postés 5375 Date d'inscription dimanche 4 mai 2003 Statut Modérateur Dernière intervention 14 juin 2023 - 3 févr. 2006 à 16:44
Bonjour,

dans le cadre de l'internationalisation d'une
application, il m'a été demandé de créer un JAR contenant tout les
fichiers d'aide selon les langues.

Voici l'architecture du JAR lui même contenu dans le répertoire lib soit :

WEB-INF
|___lib
|___I18N.jar
|____FR
|__Aide -> les fichiers d'aide, par exemple sommaire.html
|
|____ES
|__Aide-> le fichier sommaire.html

Avant j'avais ces fichiers dans un réperoire html et au niveau de ma JSP j'ouvrais une popup en pointant sur le fichier html (en paramètre) soit :


var
window.top.page_d_aide = "sommaire.html";
function pop_aide () {

var chemin_fichier = "smn/html/aide/" + window.top.page_d_aide;
var viewerpop = open
("smn/jsp/aide/frame_aide.jsp?aidejsp=" + chemin_fichier , "AIDE","height =430,Width=530,toolbar=no,scrollbars=yes");
viewerpop.window.moveTo(80,100);
}

Maintenant le fichier html ne se trouve plus dans
html/aide/ mais dans la lib dans le répertoire FR/Aide
Comment puis je faire pour que ma JSP pointe sur mon fichier html présent dans la lib ?

Merci de votre aide

1 réponse

Twinuts Messages postés 5375 Date d'inscription dimanche 4 mai 2003 Statut Modérateur Dernière intervention 14 juin 2023 111
3 févr. 2006 à 16:44
Salut,



revois ton dernier post http://www.javafr.com/forum.v2.aspx?ID=653766,
mais bon si tu n'aime pas l'exemple avec une image.... voici la def de
la methode


getResource


public URL getResource(String name)



Finds the resource with the given name. A resource is some data
(images, audio, text, etc) that can be accessed by class code in a way
that is independent of the location of the code.

The name of a resource is a '<tt>/</tt>'-separated path name that
identifies the resource.

This method will first search the parent class loader for the
resource; if the parent is <tt>null</tt> the path of the class loader
built-in to the virtual machine is searched. That failing, this method
will invoke
findResource(String)
to find the resource.

<dl> * Parameters: : <dd>
name
- The resource name
* Returns: : A <tt>URL</tt> object for reading the resource, or
<tt>null</tt> if the resource could not be found or the invoker
doesn't have adequate privileges to get the resource. * Since: : <dd>1.1

</dd>
</dl>


WORA
0
Rejoignez-nous