Bonjour,
je n'arrive pas a ajouter une ligne à la datagrid à partir d'une servlet

voici pour ma class JS
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
CreateSite = function(siteDataStore) {
 
	var reference = new Ext.form.TextField({
        fieldLabel: 'reference',
        allowBlank: false,
        name: 'reference',
        anchor: '90%'  
    });  
 
	var description = new Ext.form.TextField({
        fieldLabel: 'description',
        allowBlank: false,
        name: 'description',
        anchor: '90%'  
    });
 
    var formPanel = new Ext.form.FormPanel({
        baseCls: 'x-plain',
        labelWidth: 75,
        url:'servlet/SiteCRUDServlet?action=create',    // When the form is submitted call this url.
		onSubmit: Ext.emptyFn, 
        items: [								       // Add the fields defined above to the form.
 
            reference,
            description
 
		]
    });
 
    // Define a window with the form panel in it and show it.
    var window = new Ext.Window({
        title: 'Add New Site',
        width: 200,
        height: 200,
        minWidth: 200,
        minHeight: 200,
        layout: 'fit',
        plain: true,
        bodyStyle: 'padding:5px;',
        buttonAlign: 'center',
        items: formPanel,
 
        buttons: [{
            text: 'Save', 
            handler: saveSite				// The method to call when the save button is clicked.
        },{
            text: 'Cancel',
            handler: cancelAdd					// The method to call when the cancel button is clicked.
        }]
    });
 
 
    /*corps.add(window);
    //alert("ffff3");
    //rafraichir la page
    corps.doLayout(); */
    window.show();	
 
    // Display the popup window.
 
    /**
     * Method is called when the cancel button is clicked on the create person window.
     * Simply hide the window.
     */
    function cancelAdd() {
    	window.hide();
    }
 
 
    function saveSite() {
 
    	// Check if the form is valid. 
        if (formPanel.form.isValid()) {
 
	 		// If the form is valid, submit it.
	 		// To enable normal browser submission of the Ext Form contained in this 
			// FormPanel, override the submit method.
			formPanel.form.submit({			      
				waitMsg: 'In processing',		
				// The function to call when the response from the server was a failed 
     			// attempt (save in this case), or when an error occurred in the Ajax 
     			// communication. 
				failure: submitFailed,			
				// The function to call when the response from the server was a successful
     			// attempt (save in this case).
				success: submitSuccessful
			});                   
        } else {
        	// If the form is invalid.
			Ext.MessageBox.alert('Error Message', 'Please fix the errors noted.');
		}
    }
 
 
    function submitSuccessful(form, action) {
    	Ext.MessageBox.alert('Confirm', action.result.message);
 
		// Hide the popup window.
		window.hide();
 
		// Reload the data store with a call to the server and load
		// the grid again with the newly added person.
		siteDataStore.load({params:{start:0, limit:10}});
    }
 
 
    function submitFailed(form, action) {
 
    	var failureMessage = "Error occurred trying to save data.";
 
		// Failure type returned when no field values are returned in the 
		// response's data property or the successProperty value is false.
		if (action.failureType == Ext.form.Action.LOAD_FAILURE) {
			// Error on the server side will include an error message in 
			// the response.			
			failureMessage = action.result.message;
		} 
		// Failure type returned when a communication error happens when 
		// attempting to send a request to the remote server.
		else if (action.failureType == Ext.form.Action.CONNECT_FAILURE) {
 
			// The XMLHttpRequest object containing the 
     		// response data. See <a href="http://www.w3.org/TR/XMLHttpRequest/" target="_blank">http://www.w3.org/TR/XMLHttpRequest/</a> for 
     		// details about accessing elements of the response.
			failureMessage = "Please contact support with the following: " + 
				"Status: " + action.response.status + 
				", Status Text: " + action.response.statusText;
		}
		// Failure type returned when server side validation of the Form fails 
		// indicating that field-specific error messages have been returned in 
		// the response's errors property.
		else if (action.failureType == Ext.form.Action.SERVER_INVALID) {
			// Validation on the server side will include an error message in 
			// the response.
			failureMessage = action.result.message;
		}
		// Failure type returned when client side validation of the Form fails 
		// thus aborting a submit action.
		else if (action.failureType == Ext.form.Action.CLIENT_INVALID) {
			failureMessage = "Please fix any and all validation errors.";
		} 
		// Since none of the failure types handled the error, simply retrieve
		// the message off of the response. The response from the server on a 
		// failed submital (application error) is:
		// {success: false, message: 'Person was not saved successfully. Please try again.')
		else {
			failureMessage = action.result.message;		
		}
 
		Ext.MessageBox.alert('Error Message', failureMessage);
    }
 
 
};
pour la partie servlet la voila :
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
private String createSite(HttpServletRequest request) {
 
 
		/*
		System.out.println("****createSite");
 
		Map<String, String> fieldErrors = new HashMap<String, String>();
		System.out.println("****createSite1");
 
		OptimSiteType site = new OptimSiteType();
		System.out.println("****createSite2");
		String foo1 = request.getParameter("Reference");
		System.out.println("**** foo1 -> " + foo1);
		if (request.getParameter("reference") != null) {
			String reference = (String) request.getParameter("Reference").trim();
			site.setReference(reference);
 
		}
		System.out.println("****createSite3");
 
		String foo2 = request.getParameter("Description");
		System.out.println("**** foo2 -> " + foo2);
		if (request.getParameter("Description") != null) {
			String reference = (String) request.getParameter("Description").trim();
			site.setDescription(reference);
		}
 
 
		// Pause the thread for 5 seconds to see the screen.
		try {
			Thread.sleep(5000);
		} catch (Exception e) {}
 
		String response = null;
 
		// If there was a error in one of the fields the fieldErrors Map will
		// not be empty.
		if (fieldErrors.size() > 0) {
			response = JsonResponseGeneratorUtil.generateValidationErrorsResponse(
					false, "Merci de completer les champs manquants.", fieldErrors);
		} else {
 
			// Add the person to the http session for the user.
			List<OptimSiteType> sites =
					(List<OptimSiteType>) request.getSession().getAttribute("sites");
 
 
			sites.add(site);
 
			response = JsonResponseGeneratorUtil.generateSimpleResponse(
					true, "Le site est enregistree avec success");
			}
		*/
		System.out.println("------ attributes  1");
		String reference = null;
		if (request.getParameter("reference") != null) {
			reference = (String) request.getParameter("reference").trim();
			System.out.println("------ reference : " + reference);
 
		}
		String description = null;
		if (request.getParameter("description") != null) {
			description = (String) request.getParameter("description").trim();
			System.out.println("------ description : " + description);
		}
 
		OptimSiteType site = new OptimSiteType();
		site.setReference(reference);
		site.setDescription(description);
 
		// Extraire la variable globale du site
		// C'est une liste à laquelle il faut ajouter site 
 
		ServletUtils utils = new ServletUtils();
		System.out.println("------ attributes  2");
		ServletConfig sc = getServletConfig();
		System.out.println("------ attributes  3");
		ServletContext contexte = sc.getServletContext();
		System.out.println("------ attributes  4");
 
	    utils.displayAllAttribute(sc, contexte);
 
 
		System.out.println("------ attributes");
		Enumeration list = request.getAttributeNames();
		if (list == null) {
			System.out.println("------ List : empty");	
		} else {
			System.out.println("------ List : not empty" + list.toString());	
 
		}
		javax.servlet.http.HttpSession session = request.getSession();
 
		System.out.println(session.getAttribute("abder"));
		for (; list.hasMoreElements() ;) {
 
			System.out.println("gggggg : " + list.toString());
		   	System.out.println( " attribute :  " + list.nextElement());
		}
		String a = " create Site ";
		return a;
	}
merci en avance