Bonjour,
Je viens vers vous désespérez 2 jours que j'essaie un truc bête, l'objectif est de chargé dynamquement des pages web avec direct web rendering.
Pour celà une page index.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
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>Test</title>
        <meta name="ROBOTS" content="INDEX, FOLLOW"/>
        <meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8"/>
        <meta http-equiv="content-style-type" content="text/css"/>
        <link href="JACoMode.css" rel="stylesheet" type="text/css"/>
        <script type="text/javascript" src='dynamicForward.js'/>
    </head>
    <body>
        <div id="conteneur">
            <div id="header">
                <a href="index.jsp"><img src="IMAGES/JACoMode.png" width="200px" height="60px" border="0px" alt="JACoMode.png"/></a><h2>Graphical frontend for ACoM</h2>
            </div>
            <div id="left">
              <p class="titleCenter" >Menu<p>
              <a href="#" title="formulaire"         onclick="forward('processNewFile');">Process new files</a><br/>
              <a href="#" title="Comparaison"        onclick="forward('statistics');"    >Compare statistics</a><br/>
              <a href="#" title="Comparaison"        onclick="forward('resultGlobal');"  >Global result</a><br/>
              <a href="#" title="Comparaison"        onclick="forward('resultTable');"   >Table result</a><br/>
              <a href="#" title="Overall reaction"   onclick="forward('');"              >Overall reactions</a><br/>
              <a href="#" title="About VisuACoM"     onclick="forward('about');"         >About VisuACoM</a><br/>
            </div>
            <div id="center">
 
            </div>
            <div id="foot">
            </div>
        </div>
    </body>
</html>
un fichier javascript
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
 
function forward(webPage)
{
    Content.getInclude(function(data)
    {
        dwr.util.setValue("center", data, { escapeHtml:false });
    }
    ,webPage);
}
Dans le dossier WEB-INF
le fichier 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="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    <display-name>JACoMode</display-name>
    <servlet>
        <servlet-name>Content</servlet-name>
        <servlet-class>fr.ubdx1.jacomode.controler.Content</servlet-class>
        <init-param>
            <param-name>urlMain</param-name>
            <param-value>/pages/main.jsp</param-value>
        </init-param>
        <init-param>
            <param-name>urlAbout</param-name>
            <param-value>/pages/about.jsp</param-value>
        </init-param>
        <init-param>
            <param-name>urlResultGlobal.jsp</param-name>
            <param-value>/pages/resultGlobal.jsp</param-value>
        </init-param>
        <init-param>
            <param-name>urlProcessNewFile</param-name>
            <param-value>/pages/processNewFile.jsp</param-value>
        </init-param>
        <init-param>
            <param-name>urlResultTable</param-name>
            <param-value>/pages/resultTable.jsp</param-value>
        </init-param>
        <init-param>
            <param-name>urlErrors</param-name>
            <param-value>/pages/error.jsp</param-value>
        </init-param>
    </servlet>
    <servlet-mapping>
        <servlet-name>Content</servlet-name>
        <url-pattern>/index.jsp</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>/index.jsp</welcome-file>
    </welcome-file-list>
</web-app>
le fichier dwr.xml
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dwr PUBLIC
    "-//GetAhead Limited//DTD Direct Web Remoting 2.0//EN"
    "http://getahead.org/dwr/dwr20.dtd">
<dwr>
    <allow>
        <create creator="new" javascript="Content">
            <param name="class" value="fr.ubdx1.jacomode.controler.Content"/>
        </create>
    </allow>
</dwr>
un sevlet Content.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
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
 
package fr.ubdx1.jacomode.controler;
 
import java.util.ArrayList;
import java.io.IOException;
//import java.io.PrintWriter;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.directwebremoting.WebContext;
import org.directwebremoting.WebContextFactory;
 
public class Content extends HttpServlet
{
    String      urlMain             = null;
    String      urlAbout            = null;
    String      urlResultGlobal     = null;
    String      urlProcessNewFile   = null;
    String      urlResultTable      = null;
    String      urlErrors           = null;
    ArrayList   errors              = new ArrayList();
 
    /**
     * Init like as java constructor
     */
    @Override
    public void init()
    {
        ServletConfig config    = getServletConfig();
 
        urlMain             = config.getInitParameter("urlMain");
        if (urlMain == null)
        {
            errors.add("Parameter [urlMain] are not initialized");
        }
 
        urlAbout            = config.getInitParameter("urlAbout");
        if (urlAbout == null)
        {
            errors.add("Parameter [urlAbout] are not initialized");
        }
 
        urlResultGlobal     = config.getInitParameter("urlResultGlobal");
        if (urlResultGlobal == null)
        {
            errors.add("Parameter [urlResultGlobal] are not initialized");
        }
 
        urlProcessNewFile   = config.getInitParameter("urlProcessNewFile");
        if (urlProcessNewFile == null)
        {
            errors.add("Parameter [urlProcessNewFile] are not initialized");
        }
 
        urlResultTable      = config.getInitParameter("urlResultTable");
        if (urlResultTable == null)
        {
            errors.add("Parameter [urlResultTable] are not initialized");
        }
 
        urlErrors = config.getInitParameter("urlErrors");
    }
 
    /** 
     * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
    {
        response.setContentType("text/html;charset=UTF-8");
 
        // Check if servet has got all url param at not null
        if(urlErrors==null) throw new ServletException("Parameter [urlErrors] are not initialized");
 
        // If some error are detected
        if (errors.size()!=0)
        {
            // Go to error web page
            request.setAttribute("errors",errors);
            getServletContext().getRequestDispatcher(urlErrors).forward(request,response);
        }
        else
        {
            getServletContext().getRequestDispatcher(urlMain).forward(request,response);
        }
        return;
    }
 
    // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
    /**
     * Handles the HTTP <code>GET</code> method.
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
    {
        processRequest(request, response);
    }
 
    /**
     * Handles the HTTP <code>POST</code> method.
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
    {
        processRequest(request, response);
    }
 
 
    /** 
     * Returns a short description of the servlet.
     * @return a String containing servlet description
     */
    @Override
    public String getServletInfo()
    {
        return "Short description";
    }// </editor-fold>
 
    public String getInclude(String url) throws ServletException, IOException
    {
        WebContext wctx         = WebContextFactory.get();
        String urlForwarding    = null;
        url                     = createURL(url);
 
        if (url.equals(urlAbout) || url.equals(urlMain) || url.equals(urlProcessNewFile) || url.equals(urlResultGlobal) || url.equals(urlResultTable) )
        {
            urlForwarding = wctx.forwardToString(url);
        }
        else
        {
             urlForwarding = wctx.forwardToString(createURL(urlErrors));
        }
        return urlForwarding;
    }
 
    private String createURL(String url)
    {
        String newUrl = "/pages/";
        return newUrl+url+".jsp";
    }
}
les fichiers jsp a inclure sont dans /pages/*.jsp au niveau du div ayant l'id center dans index.jsp

Ah oui! donc qaund je clic sur les liens du menu rien ne se passe pas et encore moins l'inclusion de la page a l'endroit désiré

Merci d'avoir lu jusque là si vous avez une solution ....