Bonjour,

Débutant sur JSON, je tente d'effectuer une très simple action struts2 avec un result type=json mais je pars systématiquement en HTTP404 (message d'erreur : Error 404: SRVE0190E: Fichier non trouv? : /getJSONResult.action)

Le code que j'utilise est issu d'exemples fournis sur le net

Voici mon Struts.congif
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
 
<struts>
	<constant name="struts.enable.DynamicMethodInvocation" value="true" />
	<constant name="struts.devMode" value="false" />
	<constant name="struts.custom.i18n.resources" value="package" />
 
	<package name="default" namespace="/" extends="json-default">
               <action name="getJSONResult"  class="beanAction.JSONDataAction">
       	              <result type="json"></result>
               </action>
    </package>
</struts>
Mon Action :
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
 
package beanAction;
 
import java.util.HashMap;
import java.util.Map;
 
import org.apache.struts2.json.annotations.JSON;
 
import com.opensymphony.xwork2.Action;
 
 
public class JSONDataAction{
 
	private String field1 = "str";
    private int[] ints = {10, 20};
    private Map map = new HashMap();
    private String customName = "custom";
 
    //'transient' fields are not serialized
    private transient String field2;
 
    //fields without getter method are not serialized
    private String field3;
 
    public String execute() {
        map.put("John", "Galt");
        System.out.println("execute");
        return null;
    }
 
    public String getField1() {
        return field1;
    }
 
    public void setField1(String field1) {
        this.field1 = field1;
    }
 
    public int[] getInts() {
        return ints;
    }
 
    public void setInts(int[] ints) {
        this.ints = ints;
    }
 
    public Map getMap() {
        return map;
    }
 
    public void setMap(Map map) {
        this.map = map;
    }
 
    @JSON(name="newName")
    public String getCustomName() {
        return this.customName;
    }
}
Je teste directement l'action via l'URL : http://localhost/appli1/getJSONResult.action

Selon mes logs, je rentre/sort bien de l'action mais après plus rien.

Je suis sous WebSphere 6.1, j'utilise les librairies struts2-core-2.3.7 et struts2-json-plugin-2.3.7 (venant du package complet struts-2.3.7).

Merci d'avance de votre aide.