Redirection JavaScript pour les navigateurs

Cette redirection JavaScript :

  • n'est pas la plus propre
  • est utile si vous souhaitez que l'internaute soit redirigé sur une autre URL contenant votre application
  • fonctionne uniquement si l'internaute autorise l'exécution du JavaScript dans son navigateur

Pour faire une redirection la plus simple en JavaScript (uniquement pour les navigateurs) de la page d'acceuil de Jboss vers une application :

jboss-4.2.3.GA/server/default/deploy/jboss-web.deployer/ROOT.war/index.html, ajout du script suivant dans les balises <head> :

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
   <script type="text/javascript">
   <!--
   window.location = "./LeContexteDuneAutreApplication/"
   //-->
   </script>
 
   <title>Welcome to JBoss&trade;</title>
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
   <link rel="StyleSheet" href="jboss.css" type="text/css"/>
</head>

Redirection par définition du contexte

Redéfinir le contexte root reste la meilleure et plus propre des solutions, pour cela vous pouvez suivre :

1) The root app is located at server/xxx/jboss-web.deployer/ROOT.war. You can change the contents of that directory to reflect your app. For example, change the index.html file to show a different page.

2) You could remove the ROOT.war, and in the WAR file for one of your apps add a WEB-INF/jboss-web.xml file with these contents:

<jboss-web>
<context-root>/</context-root>
</jboss-web>
If not needed you can also consider to remove
ROOT.war application from server/default/deploy/jboss-web.deployer directory
jmx-console application from server/default/deploy directory
web-console application from the server/default/deploy/managementconsole-mgr.sar