bonjour
je suis débutant dans le développement web en java, et j'utilise les jsp avec du dwr pour l'utilisation des classe java en javascript
mais mon problème c'est que le dwr me renvoie une erreur (juste alert "erreur") lorsque mes fonctions ne sont pas static mais lorsqu'elle le sont, ca fonctionne bien mais le probleme c'est qu'ils doivent etre non static et je ne sais pas comment faire
pouvez-vous m'aider??
voici mon mapping dwr :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
 <create creator="new" javascript="modificationDocument" scope="session"   >
        	<param name="class" value="org.alff.test.webservice.ModificationDocument"   />
        </create>
et voici mon code javascript:


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
function ValiderPost(code){
 
	var start = new Object();
    var end = new Object();
    var tree = $("prospect.report");
    var id = null;
    var t22= null;
    var action= 1;
    if (action != -1) {
        tree.view.selection.getRangeAt(0, start, end);
		if (start.value != -1) {
			id = tree.view.getCellText(start.value, tree.columns.getNamedColumn("results_0"));
 
		}
		var x= document.getElementById('Report.title_file').value;
		var y= $("Report.commenter").value;
		var z= document.getElementById('prospect.codpays_prosp').value;
		var t= document.getElementById('prospect.codrep_prosp').value;
		var t1=document.getElementById('cache').value;
		z+= "        ";
		z+= id ;
		z+= "        ";
		z+= t;
 
 
 
		modificationDocument.create_post_it(t1, x,x, y, id, function(resultat){
			alert(resultat);
			document.getElementById("cache").collapsed= true;
			document.getElementById("cache1").collapsed= true;
			document.getElementById("cache2").collapsed= true;
			document.getElementById('prospect.editReport').collapsed= true;
			ajouter_info(resultat, code);
 
		});
	}
}

et ma classe 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
public class ModificationDocument  {
	public String titre;
 
	public String ID;
	public String commentaire;
 
	public String id_prosp1;
	public int code_user;
 
	public ModificationDocument(String s) {
		this.titre = s;
	}
	public ModificationDocument(){
 
	}
	public String create_post_it(String k, String s, String doc1,String doc2, String id) throws Exception {
 
		//Properties opp= new Properties();
		  //opp.load(this.getClass().getResourceAsStream("/alfresco.properties"));
 
		//System.out.println(opp.getProperty("identifiant").toString());
		AuthenticationUtils.startSession("admin","admin");
 
 
		// Create a reference to the parent where we want to create content
		Store storeRef = new Store(Constants.WORKSPACE_STORE, "SpacesStore");
		String folderPath = "/app:company_home/cm:yassine_test";
		ParentReference companyHomeParent = new ParentReference(storeRef, null,
				folderPath, Constants.ASSOC_CONTAINS, Constants.createQNameString("http://www.alfresco.org/model/content/1.0",s));
 
		// Assign name
		String name = s;
		System.out.println(name);
 
		// Construct CML statement to create content node
		// Note: Assign "1" as a local id, so we can refer to it in
		// subsequent
		// CML statements within the same CML block
		NamedValue[] contentProps = new NamedValue[1];
		contentProps[0] = Utils.createNamedValue(Constants.PROP_NAME, name);
		CMLCreate create = new CMLCreate("1", companyHomeParent, null, null,
				null, Constants.TYPE_CONTENT, contentProps);
 
		// Construct CML statement to add titled aspect
		NamedValue[] titledProps = new NamedValue[2];
		titledProps[0] = Utils.createNamedValue(Constants.PROP_TITLE, name);
		titledProps[1] = Utils.createNamedValue(Constants.PROP_DESCRIPTION,
				doc2);
		NamedValue nameValue = Utils
				.createNamedValue(Constants.PROP_NAME, name);
		CMLAddAspect addAspect = new CMLAddAspect(Constants.ASPECT_TITLED,
				titledProps, null, "1");
 
		// Construct CML Block
		CML cml = new CML();
		cml.setCreate(new CMLCreate[] { create });
		cml.setAddAspect(new CMLAddAspect[] { addAspect });
 
		// Issue CML statement via Repository Web Service and retrieve
		// result
		// Note: Batching of multiple statements into a single web call
		UpdateResult[] result = WebServiceFactory.getRepositoryService().update(cml);
		Reference content = result[0].getDestination();
 
		//
		// Write some content
		//
 
		ID = content.getUuid();
 
		// ProspectService.addOrModifyReport(ID);
 
		ContentServiceSoapBindingStub contentService = WebServiceFactory
				.getContentService();
		String text = k;
		ContentFormat contentFormat = new ContentFormat("text/plain", "UTF-8");
		Content contentRef = contentService.write(content,
				Constants.PROP_CONTENT, text.getBytes(), contentFormat);
 
		System.out.println("Content Length: " + contentRef.getLength());
		System.out.println(ContentUtils.getContentAsString(contentRef));
		return ID;
 
	}
merci a vous
cordialement