Voilà un nouvel article/tutoriel sur la communication entre portlets, JSR 286.
http://natoine.developpez.com/tutoriels/java/portlet/
A vos commentaires, retours, questions.
Voilà un nouvel article/tutoriel sur la communication entre portlets, JSR 286.
http://natoine.developpez.com/tutoriels/java/portlet/
A vos commentaires, retours, questions.
Très bon tutoriel, il m'a bien aidé
J'ai par contre un peu de mal avec la sérialisation... Pourriez-vous apporter quelques précisions ?
Ok j'ai réussi en m'aidant de ce lien (réponse de OscarRyz) :
http://stackoverflow.com/questions/1...-into-a-string
Est-ce une bonne manière de faire ?
tu pourrais me fournir un exemple de code précisant ton problème ?
Passer un objet plutôt qu'une String en event entre portlets est assez simple mais il faut bien respecter deux choses absolument :
* Annoter la classe à transmettre en event avec le tag xmlRootElement
* Que cette classe soit serializable (c'est à dire qu'elle implémente l'interface Serializable)
Par exemple :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 @XmlRootElement public class Agent implements Serializable
Donc par exemple pour envoyer une information à une autre portlet on utilise cette méthode. Mais on est limité à une simple String.
Pour transmettre un objet, j'ai été obligé de sérialiser l'objet dans une string puisqu'on ne peut pas modifier le prototype de setEvent. De la manière suivante :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 public void sendEvent(ActionRequest request, ActionResponse response) throws IOException { String str = "user89"; response.setEvent("event_newUserConnected", str); }
Classe sérialisable
Envoi de l'event
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 @XmlRootElement public class User implements Serializable{ private static final long serialVersionUID = 1L; private String _name; private String _surname; public User(){ this("Name", "Surname"); } public User(String name, String surname){ _name = name; _surname = surname; } public String name(){ return _name; } public String surname(){ return _surname; } }
Reception de l'event
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 public void sendEvent(ActionRequest request, ActionResponse response) throws IOException { User user = new User("Jean-paul", "Dupont"); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream( baos ); oos.writeObject(user); oos.close(); String str_obj = new String(Base64Coder.encode(baos.toByteArray()) response.setEvent("event_newUserConnected", str_obj); }
Avec Base64Coder dispo ici : http://www.source-code.biz/base64cod...Coder.java.txt
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 public void processEvent(EventRequest request, EventResponse response) { Event event = request.getEvent(); if (event.getName().equals("event_newUserConnected")) { byte [] data = Base64Coder.decode((String) event.getValue()); ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(data)); User user = (User)ois.readObject(); ois.close(); }
Bon je ne suis pas sur de ce code, je l'ai retapé, je ne l'utilise plus. Actuellement j'utilise les variables de session. Quoiqu'il en soit je vais quand meme surement m'en reservir à l'avenir donc si tu as des remarques sur la méthode...![]()
Je pense que tu n'appelles pas la bonne méthode setEvent.
Ou alors tu n'utilises pas la bonne api.
J'utilise maven et ma dépendance à l'api portlet JSR 286 :
Maintenant voilà un exemple complet de ce que je fais. Je n'ai pas nettoyé mon code. Tu as tout au complet et donc beaucoup de choses en trop...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7<dependency> <groupId>javax.portlet</groupId> <artifactId>portlet-api</artifactId> <version>2.0</version> <scope>provided</scope> </dependency>
Le code de la classe qui sera passé en event :
J'utilise aussi hibernate pour la persistence, d'où les annotations JPA dans mon code.
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 @Entity @Table(name = "SELECTIONHTML") @XmlRootElement public class SelectionHTML extends Selection implements HTMLContentable { @Column(name = "XPOINTERBEGIN" , nullable=false) private String xpointerBegin; @Column(name = "XPOINTEREND" , nullable=false) private String xpointerEnd; @Lob @Column(name = "HTMLCONTENT" , nullable=false) private String HTMLContent; /** * Gets the HTML Content of the html Selection * @return */ public String getHTMLContent() { return HTMLContent; } /** * Sets the HTML Content of the html Selection */ public void setHTMLContent(String hTMLContent) { HTMLContent = hTMLContent; } /** * Gets the XPointerBegin of the html Selection * @return */ public String getXpointerBegin() { return xpointerBegin; } /** * Sets the XPointerBegin of the html Selection * @param xpointerBegin */ public void setXpointerBegin(String xpointerBegin) { this.xpointerBegin = xpointerBegin; } /** * Gets the XPointerEnd of the html Selection * @return */ public String getXpointerEnd() { return xpointerEnd; } /** * Sets the XPointerEnd of the html Selection * @param xpointerEnd */ public void setXpointerEnd(String xpointerEnd) { this.xpointerEnd = xpointerEnd; } }
Le code de la classe qui envoie l'event :
La méthode doSelection appelée par la méthode processAction envoi l'event en appelant la méthode sendEvent.
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350 public class PortletWebBrowser extends GenericPortlet implements EventPortlet { private static String defaultURL = "http://www.google.com"; private static String defaultHeight = "200px"; private static String defaultWidth = "100%"; private static String defaultMessage = "There is a problem with your URL"; public void processAction(ActionRequest request, ActionResponse response) throws PortletException, PortletSecurityException, IOException { String op = request.getParameter("op"); StringBuffer message = new StringBuffer(1024); if ((op != null) && (op.trim().length() > 0)) { //Mise à jour de l'url dans la barre de navigation de la portlet en View if (op.equalsIgnoreCase("go")) { doGo(request , response , message); return; } //il y a eu une action de sélection pour annotation else if(op.equalsIgnoreCase("selection")) { doSelection(request , response); return; } //mise à jour des données par interface Edit else if (op.equalsIgnoreCase("update")) { doUpdate(request , response , message); return; } else if (op.equalsIgnoreCase("cancel")) { doCancel(response); return; } else if(op.equalsIgnoreCase("Page")) { doPage(request, response); return ; } else { System.out.println("[BrowserPortlet.processAction 2]" + op); message.append("Operation not found"); } } else { System.out.println("[BrowserPortlet.processAction 3]" + op); message.append("Operation is null"); } System.out.println("[BrowserPortlet.processAction 4]" + op); response.setRenderParameter("message", message.toString()); response.setPortletMode(PortletMode.VIEW); } public void doView(RenderRequest request, RenderResponse response) { try { setRenderAttributes(request); response.setContentType("text/html"); PortletRequestDispatcher prd = getPortletContext() .getRequestDispatcher("/WEB-INF/jsp/browser.jsp"); prd.include(request, response); } catch (Exception e) { e.printStackTrace(); } } public void doEdit(RenderRequest request, RenderResponse response) throws IOException, PortletException { setRenderAttributes(request); response.setContentType("text/html"); response.setTitle("Edit"); PortletRequestDispatcher prd = getPortletContext() .getRequestDispatcher("/WEB-INF/jsp/edit.jsp"); prd.include(request, response); } private void setRenderAttributes(RenderRequest request) { String currentURL = defaultURL; request.getPortletSession().setAttribute("default_url", defaultURL, request.getPortletSession().APPLICATION_SCOPE); request.setAttribute("default_url", defaultURL); if(request.getParameter("height")!=null) request.setAttribute("height" , request.getParameter("height")); else request.setAttribute("height", PortletWebBrowser.defaultHeight); if(request.getParameter("width")!=null) request.setAttribute("width" , request.getParameter("width")); else request.setAttribute("width", PortletWebBrowser.defaultWidth); if(request.getParameter("message")!=null) request.setAttribute("message" , request.getParameter("message")); else request.setAttribute("message", PortletWebBrowser.defaultMessage); if(request.getPortletSession().getAttribute("current_url")!=null) currentURL = (String)request.getPortletSession().getAttribute("current_url"); request.setAttribute("url", currentURL); String _clean_html = HTMLmanager.getCleanHTML(currentURL); //HTMLParser.toStringFromHTML(currentURL) ; /*if(request.getParameter("url")!=null) currentURL = request.getParameter("url"); request.setAttribute("url", currentURL); String _clean_html = HTMLmanager.getCleanHTML(currentURL); //HTMLParser.toStringFromHTML(currentURL) ; */ //on set la liste de highlights ArrayList<HighlightSelectionHTML> _highlights ; if(request.getPortletSession().getAttribute("highlights")!=null) _highlights = ((ArrayList<HighlightSelectionHTML>)request.getPortletSession().getAttribute("highlights")); else _highlights = new ArrayList<HighlightSelectionHTML>(); //pour passer les highlights au JSP //request.setAttribute("highlights" , _highlights); //processes all the highlights to add them in html //System.out.println("[PortletWebBrowser.setRenderAttributes] html : " + _clean_html); //System.out.println("[PortletWebBrowser.setRenderAttributes] highlights size : " + _highlights); _clean_html = HTMLmanager.colorHighlights(_clean_html, _highlights); request.setAttribute("html" , _clean_html); } private void doGo(ActionRequest request, ActionResponse response , StringBuffer message) throws ReadOnlyException, ValidatorException, IOException, PortletModeException { boolean save = true; //PortletPreferences prefs = request.getPreferences(); String url = request.getParameter("url"); if (!url.startsWith("http://")) { save = false; message.append("URLs must start with 'http://'<br/>"); response.setRenderParameter("message", message.toString()); response.setPortletMode(PortletMode.VIEW); } if (save) { request.getPortletSession().removeAttribute("highlights"); //response.setRenderParameter("url", url.toLowerCase()); request.getPortletSession().setAttribute("current_url", url.toLowerCase()); this.sendEvent("loadedurl", url.toLowerCase(), response); response.setPortletMode(PortletMode.VIEW); request.getPortletSession().removeAttribute("highlights"); } } private void sendEvent(String _event_type , Serializable _event_object , ActionResponse response) { System.out.println("[BrowserPortlet.sendEvent] type : " + _event_type + " value : " + _event_object); response.setEvent(_event_type, _event_object); } private void doSelection(ActionRequest request , ActionResponse response) { System.out.println("[BrowserPortlet.doSelection]"); String url = request.getParameter("url") ; String title = HTMLmanager.getTitlePage(url) ; SelectionHTML _selection_html = new SelectionHTML(); _selection_html.setHTMLContent(request.getParameter("text_selection")); _selection_html.setXpointerBegin(request.getParameter("xpointer_start")); _selection_html.setXpointerEnd(request.getParameter("xpointer_end")); _selection_html.setContextCreation("PortletWebBrowser"); _selection_html.setCreation(new Date()); _selection_html.setLabel("sélection de : " + title); //_selection_html.setRepresentsResource(representsResource); WebPage selectionOrigin = new WebPage(); URI _access = new URI(); _access.setEffectiveURI(url); selectionOrigin.setAccess(_access); selectionOrigin.setContextCreation("PortletWebBrowser"); selectionOrigin.setCreation(new Date()); selectionOrigin.setHTMLContent(HTMLmanager.getCleanHTML(url)); selectionOrigin.setLabel(title); selectionOrigin.setPrincipalURL(_access); selectionOrigin.setRepresentsResource(_access); _selection_html.setSelectionOrigin(selectionOrigin); HighlightSelectionHTML _highLight = new HighlightSelectionHTML(); _highLight.setSelection(_selection_html); _highLight.setStyle("background-color:yellow;"); _highLight.setInfo("sélection en attente d'annotation"); _highLight.setId(generateHighlightId(request)); //_selection_html.setClassname("new_selection"); this.sendEvent("selection", _highLight, response); //ajouter la nouvelle sélection à la liste courante ArrayList<HighlightSelectionHTML> _highlights ; if(request.getPortletSession().getAttribute("highlights")!=null) { _highlights = (ArrayList<HighlightSelectionHTML>)request.getPortletSession().getAttribute("highlights") ; } else _highlights = new ArrayList<HighlightSelectionHTML>(); _highlights.add(_highLight); request.getPortletSession().setAttribute("highlights" , _highlights); //response.setRenderParameter("url", url); request.getPortletSession().setAttribute("current_url", url); } private void doPage(ActionRequest request , ActionResponse response) { System.out.println("[BrowserPortlet.doPage]"); String url = request.getParameter("url") ; WebPage _page = new WebPage(); URI _access = new URI(); _access.setEffectiveURI(url); _page.setAccess(_access); _page.setContextCreation("PortletWebBrowser"); _page.setCreation(new Date()); _page.setHTMLContent(HTMLmanager.getCleanHTML(url)); String title = HTMLmanager.getTitlePage(url) ; _page.setLabel(title); _page.setPrincipalURL(_access); _page.setRepresentsResource(_access); this.sendEvent("page", _page, response); //response.setRenderParameter("url", url); request.getPortletSession().setAttribute("current_url", url); } private void doUpdate(ActionRequest request, ActionResponse response , StringBuffer message) throws ReadOnlyException, ValidatorException, IOException, PortletModeException { String url = request.getParameter("default-url"); //System.out.println("[BrowserPortlet.doUpdate] url : " + url); String height = request.getParameter("height"); String width = request.getParameter("width"); String noMessage = request.getParameter("nomessage"); boolean px = false; boolean save = true ; // boolean save = true; if ((url != null) && (height != null) && (width != null) && (noMessage != null)) { if (!url.startsWith("http://")) { save = false; message.append("URLs must start with 'http://'<br/>"); } try { if (height.endsWith("px")) { height = height.substring(0, height.length() - 2); } Integer.parseInt(height); } catch (NumberFormatException nfe) { // Bad height value save = false; message.append("Height must be an integer<br/>"); } try { if (width.endsWith("px")) { px = true; width = width.substring(0, width.length() - 2); } else if (width.endsWith("%")) { width = width.substring(0, width.length() - 1); } Integer.parseInt(width); } catch (NumberFormatException nfe) { // Bad height value save = false; message.append("Width must be an integer<br/>"); } if (save) { //System.out.println("[BrowserPortlet.doUpdate] save"); response.setRenderParameter("height", height + "px"); response.setRenderParameter("width", px ? width + "px" : width + "%"); //response.setRenderParameter("url", url); request.getPortletSession().setAttribute("current_url", url); this.sendEvent("url", url, response); response.setRenderParameter("message", noMessage); defaultURL = url ; sendEvent("default_url", url, response); request.getPortletSession().setAttribute("default_url", url, request.getPortletSession().APPLICATION_SCOPE); defaultHeight = height + "px" ; defaultWidth = px ? width + "px" : width + "%" ; defaultMessage = noMessage ; response.setPortletMode(PortletMode.VIEW); return; } response.setRenderParameter("message", message.toString()); response.setPortletMode(PortletMode.VIEW); } } private void doCancel(ActionResponse response) throws PortletModeException { response.setPortletMode(PortletMode.VIEW); } public void processEvent(EventRequest request, EventResponse response) { Event event = request.getEvent(); System.out.println("[PortletWebBrowser.processEvent] event : " + event.getName()); if(event.getName().equals("tohighlight")) { Object _highlight_event = event.getValue(); //Récupérer la collection de highlights if(_highlight_event instanceof HighlightSelectionHTML) { ArrayList<HighlightSelectionHTML> _hightlights = (ArrayList<HighlightSelectionHTML>)request.getPortletSession().getAttribute("highlights"); if(_hightlights == null) _hightlights = new ArrayList<HighlightSelectionHTML>(); _hightlights.add((HighlightSelectionHTML)_highlight_event); request.getPortletSession().setAttribute("highlights" , _hightlights); } } if(event.getName().equals("todelete")) { System.out.println("[PortletWebBrowser.processEvent] event to delete"); if(event.getValue() instanceof HighlightSelectionHTML) doDelete(request , (HighlightSelectionHTML)event.getValue()); } if(event.getName().equals("toLoadUrl")) { if(event.getValue() instanceof String) { String url = (String) event.getValue(); if (url.startsWith("http://")) request.getPortletSession().setAttribute("current_url", url); //response.setRenderParameter("url", url.toLowerCase()); } } } private void doDelete(EventRequest request , HighlightSelectionHTML _to_delete) { ArrayList<HighlightSelectionHTML> _hightlights = (ArrayList<HighlightSelectionHTML>)request.getPortletSession().getAttribute("highlights"); if(_hightlights != null && _hightlights.size()>0) { System.out.println("[PortletWebBrowser.doDelete] _to_delete : " + _to_delete + " selection : " + _to_delete.getSelection() + " id : " + _to_delete.getId()); for(HighlightSelectionHTML highlight : _hightlights) { System.out.println("[PortletWebBrowser.doDelete] highlight : " + highlight + " selection : " + highlight.getSelection()+ " id : " + highlight.getId()); if(highlight.getId().compareTo(_to_delete.getId()) == 0) { _hightlights.remove(highlight); request.getPortletSession().setAttribute("highlights" , _hightlights); return ; } } } System.out.println("[PortletWebBrowser.doDelete] don't find _to_delete : " + _to_delete); } private String generateHighlightId(ActionRequest request) { int nb_highlight = 0 ; if(request.getPortletSession().getAttribute("nb_highlight")!=null) { nb_highlight = (Integer)request.getPortletSession().getAttribute("nb_highlight"); int _new_value = nb_highlight + 1; request.getPortletSession().setAttribute("nb_highlight", _new_value); } else request.getPortletSession().setAttribute("nb_highlight", 1); return request.getPortletSession().getId() + this.getPortletName() + nb_highlight; } }
Je passe l'objet sans le serialisé. Le portail s'en charge.
Le code de la classe qui reçoit l'event :
Regarde la méthode processEvent.
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530 public class PortletCreateAnnotation extends GenericPortlet implements EventPortlet { private static String defaultURL = "http://www.google.com"; private static AgentStatus default_status = null ; private static RetrieveSimpleTextStatus RETRIEVER_SIMPLETEXT_STATUS = null ; private static CreateAgentStatus CREATOR_AGENT_STATUS = null ; private static RetrieveTag RETRIEVER_TAG = null ; private static CreateTag CREATOR_TAG = null ; private static CreateAnnotation CREATOR_ANNOTATION = null ; private static CreateUri CREATOR_URI = null ; private static CreateSimpleText CREATOR_SIMPLETEXT = null ; private static CreateSelectionHTML CREATOR_SELECTIONHTML = null ; private static RetrieveUri RETRIEVER_URI = null ; private static CreateDocumentHTML CREATOR_HTML = null ; private static CreateResource CREATOR_RESOURCE = null ; private static String APPLICATION_NAME = "PortletCreateAnnotation" ; private static String URL_SERVLET_ANNOTATIONS = null ; private static final String NORMAL_VIEW = "/WEB-INF/jsp/PortletCreateAnnotation/annotate.jsp"; private static final String MAXIMIZED_VIEW = "/WEB-INF/jsp/PortletCreateAnnotation/maximized.jsp"; private static final String HELP_VIEW = "/WEB-INF/jsp/PortletCreateAnnotation/help.jsp"; private static final String EDIT_VIEW = "/WEB-INF/jsp/PortletCreateAnnotation/edit.jsp"; private PortletRequestDispatcher normalView; private PortletRequestDispatcher maximizedView; private PortletRequestDispatcher helpView; private PortletRequestDispatcher editView; public void doView( RenderRequest request, RenderResponse response ) throws PortletException, IOException { setRenderAttributes(request); if( WindowState.MINIMIZED.equals( request.getWindowState() ) ) { return; } if ( WindowState.NORMAL.equals( request.getWindowState() ) ) { normalView.include( request, response ); } else { maximizedView.include( request, response ); } } protected void doEdit( RenderRequest request, RenderResponse response ) throws PortletException, IOException { setRenderAttributes(request); editView.include( request, response ); } protected void doHelp( RenderRequest request, RenderResponse response ) throws PortletException, IOException { setRenderAttributes(request); helpView.include( request, response ); } public void init( PortletConfig config ) throws PortletException { super.init( config ); normalView = config.getPortletContext().getRequestDispatcher( NORMAL_VIEW ); maximizedView = config.getPortletContext().getRequestDispatcher( MAXIMIZED_VIEW ); helpView = config.getPortletContext().getRequestDispatcher( HELP_VIEW ); editView = config.getPortletContext().getRequestDispatcher( EDIT_VIEW ); // new CreateAnnotationStatus().createAnnotationStatus("default", "un simple ajout de commentaires à un ensemble de sélections"); // new CreateSimpleTextStatus().createSimpleTextStatus("commentaire", "un simple champ texte pour laisser un commentaire libre"); CreateAnnotationStatus _annotation_status_creator = new CreateAnnotationStatus() ; _annotation_status_creator.createSimpleCommentStatus(); _annotation_status_creator.createSimpleTagStatus(); RETRIEVER_SIMPLETEXT_STATUS = new RetrieveSimpleTextStatus(); CREATOR_ANNOTATION = new CreateAnnotation(); CREATOR_URI = new CreateUri(); RETRIEVER_URI = new RetrieveUri(); CREATOR_SIMPLETEXT = new CreateSimpleText(); CREATOR_SELECTIONHTML = new CreateSelectionHTML(); CREATOR_HTML = new CreateDocumentHTML(); CREATOR_RESOURCE = new CreateResource(); CREATOR_TAG = new CreateTag(); RETRIEVER_TAG = new RetrieveTag(); CREATOR_AGENT_STATUS = new CreateAgentStatus(); RetrieveAgentStatus _retrieve_as = new RetrieveAgentStatus(); default_status = _retrieve_as.retrieveAgentStatusDefault(); // default_status = new RetrieveAgentStatus().retrieveAgentStatusDefault(); if(default_status.getId() == null) { System.out.println("[PortletCreateAnnotation.init] creates the default status"); CREATOR_AGENT_STATUS.createAgentStatusDefault(); default_status = _retrieve_as.retrieveAgentStatusDefault(); } //provisoire en attendant de gérer totalement les descripteurs de status d'annotation new CreateSimpleTextStatus().createSimpleTextStatus("commentaire", "simple commentaire"); } public void destroy() { normalView = null; maximizedView = null; helpView = null; editView = null ; super.destroy(); } private void setRenderAttributes(RenderRequest request) { if(request.getPortletSession().getAttribute("application_name", PortletSession.APPLICATION_SCOPE)!=null) { System.out.println("[PortletInscription.setRenderAttributes] application defined at application_scope"); request.removeAttribute("config_error_message"); request.getPortletSession(); String _new_app_name = (String)request.getPortletSession().getAttribute("application_name", PortletSession.APPLICATION_SCOPE) ; APPLICATION_NAME = _new_app_name ; } if(URL_SERVLET_ANNOTATIONS != null) request.setAttribute("url_servlet", URL_SERVLET_ANNOTATIONS); else request.setAttribute("url_servlet" , ""); if(request.getParameter("message")!=null) request.setAttribute("message" , request.getParameter("message")); /*if(request.getParameter("url")!=null) request.setAttribute("url", request.getParameter("url")); else if(request.getPortletSession().getAttribute("default_url", PortletSession.APPLICATION_SCOPE) != null) request.setAttribute("url", request.getPortletSession().getAttribute("default_url", PortletSession.APPLICATION_SCOPE)); else request.setAttribute("url" , defaultURL);*/ String _current_url = defaultURL ; if(request.getPortletSession().getAttribute("current_url")!= null) _current_url = (String)request.getPortletSession().getAttribute("current_url"); request.setAttribute("url", _current_url); request.getPortletSession().setAttribute("current_url" , _current_url); if(request.getPortletSession().getAttribute("user")!=null) request.setAttribute("user", request.getPortletSession().getAttribute("user")); ArrayList _selections ; if(request.getPortletSession().getAttribute("selections") != null) _selections = (ArrayList) request.getPortletSession().getAttribute("selections") ; else _selections = new ArrayList(); request.setAttribute("selections", _selections); if(request.getPortletSession().getAttribute("annotation_status") != null) request.setAttribute("annotation_status", request.getPortletSession().getAttribute("annotation_status")); } private void sendEvent(String _event_type , Serializable _event_object , ActionResponse response) { System.out.println("[PortletCreateAnnotation.sendEvent] type : " + _event_type + " value : " + _event_object); response.setEvent(_event_type, _event_object); } public void processEvent(EventRequest request, EventResponse response) { Event event = request.getEvent(); System.out.println("[PortletCreateAnnotation.processEvent] event : " + event.getName()); String _event_name = event.getName() ; if(_event_name.equalsIgnoreCase("UserLog")) { if(event.getValue() instanceof UserAccount) { UserAccount _current_user = (UserAccount)event.getValue() ; if(_current_user.getId() != null) request.getPortletSession().setAttribute("user", _current_user); } } if(_event_name.equalsIgnoreCase("UserUnLog")) { request.getPortletSession().removeAttribute("user"); } if(_event_name.equalsIgnoreCase("loadedurl")) { if(event.getValue() instanceof String) { String url = (String) event.getValue(); if (url.startsWith("http://")) //response.setRenderParameter("url", url.toLowerCase()); request.getPortletSession().setAttribute("current_url", url.toLowerCase()); } } if(_event_name.equalsIgnoreCase("default_url")) { if(event.getValue() instanceof String) { String url = (String) event.getValue(); if (url.startsWith("http://")) this.defaultURL = url ; } } if(_event_name.equalsIgnoreCase("selection")) { if(event.getValue() instanceof HighlightSelectionHTML) { ArrayList _selections ; if(request.getPortletSession().getAttribute("selections") != null) _selections = (ArrayList) request.getPortletSession().getAttribute("selections") ; else _selections = new ArrayList(); _selections.add((HighlightSelectionHTML)event.getValue()); request.getPortletSession().setAttribute("selections", _selections); } } if(_event_name.equalsIgnoreCase("Page")) { if(event.getValue() instanceof WebPage) { ArrayList _selections ; if(request.getPortletSession().getAttribute("selections") != null) _selections = (ArrayList) request.getPortletSession().getAttribute("selections") ; else _selections = new ArrayList(); _selections.add((WebPage)event.getValue()); request.getPortletSession().setAttribute("selections", _selections); } } if(_event_name.equalsIgnoreCase("change_status")) { AnnotationStatus status = (AnnotationStatus)event.getValue(); System.out.println("[PortletCreateAnnotation.processevent] Status : " + status.getLabel()); request.getPortletSession().setAttribute("annotation_status", status); } } public void processAction(ActionRequest request, ActionResponse response) throws PortletException, PortletSecurityException, IOException { String op = request.getParameter("op"); StringBuffer message = new StringBuffer(1024); if ((op != null) && (op.trim().length() > 0)) { //Mise à jour de l'url dans la barre de navigation de la portlet en View if (op.equalsIgnoreCase("clear_selections")) { //vider la liste de sélections doClearSelections(request, response); return; } //il y a eu une action de sélection pour annotation else if(op.equalsIgnoreCase("delete_selection")) { doDeleteSelection(request , response); return; } //mise à jour des données par interface Edit else if (op.equalsIgnoreCase("create_annotation")) { doCreateAnnotation(request); response.setPortletMode(PortletMode.VIEW); return; } //mise à jour des données par interface Edit else if (op.equalsIgnoreCase("update")) { doUpdate(request , response); return; } else if (op.equalsIgnoreCase("cancel")) { doCancel(response); return; } else { System.out.println("[BrowserPortlet.processAction 2]" + op); message.append("Operation not found"); } } else { System.out.println("[PortletCreateAnnotation.processAction 3]" + op); message.append("Operation is null"); } System.out.println("[PortletCreateAnnotation.processAction 4]" + op); response.setRenderParameter("message", message.toString()); response.setPortletMode(PortletMode.VIEW); } private void doDeleteSelection(ActionRequest request, ActionResponse response) { if(request.getParameter("cpt_selection")!=null) { int _index_selection_to_delete = Integer.parseInt(request.getParameter("cpt_selection")); if(request.getPortletSession().getAttribute("selections")!=null) { ArrayList _selections = (ArrayList)request.getPortletSession().getAttribute("selections"); Object _selection_to_delete = _selections.get(_index_selection_to_delete); if(_selection_to_delete instanceof HighlightSelectionHTML) this.sendEvent("todelete", (HighlightSelectionHTML)_selection_to_delete, response); //ArrayList _to_send = new ArrayList() ; //_to_send.add(_selection_to_delete) ; _selections.remove(_index_selection_to_delete); request.getPortletSession().setAttribute("selections", _selections); } else System.out.println("[PortletCreationAnnotation.doDeleteSelection] selections attribute doesn't exist"); } else System.out.println("[PortletCreationAnnotation.doDeleteSelection] no selection to delete"); } private void doCreateAnnotation(ActionRequest request) { if(URL_SERVLET_ANNOTATIONS == null) { System.out.println("[PortletCreationAnnotation.doCreateAnnotation] URL_SERVLET_ANNOTATIONS is null"); } else { System.out.println("[PortletCreationAnnotation.doCreateAnnotation]"); //String _url = (String)request.getPortletSession().getAttribute("url"); //récupération des sélections ArrayList _selections = (ArrayList)request.getPortletSession().getAttribute("selections"); if(_selections.size() != 0) { UserAccount _author = (UserAccount)request.getPortletSession().getAttribute("user"); String annotation_title = request.getParameter("annotation_title") ; //créer l'uri d'accés et de représentation de l'annotation. //celle ci devrait être un appel à la servlet d'affichage d'annotation //Par défaut la servlet affiche toutes les annotations, sinon, en passant l'id de l'annotation en paramétre, elle n'affiche que cette annotation //créer un attribut paramétrable via l'interface admin String _effective_uri = URL_SERVLET_ANNOTATIONS; CREATOR_URI.createURI(_effective_uri); URI access = RETRIEVER_URI.retrieveURI(_effective_uri); //le status de l'annotation sera un paramètre dans le formulaire //il va donc falloir récupérer tous les status possibles, en fonction du status, le formulaire d'annotation sera différent //dans le cas du status par défaut, on fait un simple commentaire //AnnotationStatus status = new RetrieveAnnotationStatus().retrieveAnnotationStatus("commentaire"); AnnotationStatus status = (AnnotationStatus)request.getPortletSession().getAttribute("annotation_status"); //récupérer toutes les valeurs à ajouter dans le formulaire : Enumeration<String> _parameters_names = request.getParameterNames() ; String _parameter_name; Collection<Resource> added = new ArrayList<Resource>(); while(_parameters_names.hasMoreElements()) { _parameter_name = _parameters_names.nextElement(); if(_parameter_name.contains("added")) { if(_parameter_name.contains("_simpletext_")) { String _status_name = _parameter_name.substring(_parameter_name.lastIndexOf("_") + 1); SimpleTextStatus status_st = RETRIEVER_SIMPLETEXT_STATUS.retrieveSimpleTextStatus(_status_name); if(status_st == null) { status_st = RETRIEVER_SIMPLETEXT_STATUS.retrieveSimpleTextStatus("commentaire"); } SimpleText st = CREATOR_SIMPLETEXT.createAndGetSimpleText(APPLICATION_NAME, _status_name + " de l'annotation : " + annotation_title, access, request.getParameter(_parameter_name), status_st); added.add(st); } else if(_parameter_name.contains("_tag_")) { Tag _tag; String _tag_label = request.getParameter(_parameter_name); List _tags = RETRIEVER_TAG.retrieveTag(_tag_label); if(_tags.size() > 0) { _tag = (Tag)_tags.get(0); } else { URI representsResource = new URI(); //TODO setter une URI par l'admin representsResource.setEffectiveURI("http://www.uriprovisoirepourtag/" + _tag_label); _tag = CREATOR_TAG.createAndGetTag(_tag_label, " ", APPLICATION_NAME, representsResource); } added.add(_tag); } else if(_parameter_name.contains("_domain_")) { Domain _tag; String _domain_label = request.getParameter(_parameter_name); List _tags = RETRIEVER_TAG.retrieveDomain(_domain_label); if(_tags.size() > 0) { _tag = (Domain)_tags.get(0); } else { URI representsResource = new URI(); //TODO setter une URI par l'admin representsResource.setEffectiveURI("http://www.uriprovisoirepourtag/domain/" + _domain_label); _tag = CREATOR_TAG.createAndGetDomain(_domain_label, " ", APPLICATION_NAME, representsResource); } added.add(_tag); } else if(_parameter_name.contains("_judgment_")) { Judgment _tag; String _judgment_label = request.getParameter(_parameter_name); List _tags = RETRIEVER_TAG.retrieveJudgment(_judgment_label); if(_tags.size() > 0) { _tag = (Judgment)_tags.get(0); } else { URI representsResource = new URI(); //TODO setter une URI par l'admin representsResource.setEffectiveURI("http://www.uriprovisoirepourtag/judgment/" + _judgment_label); _tag = CREATOR_TAG.createAndGetJudgment(_judgment_label, " ", APPLICATION_NAME, representsResource); } added.add(_tag); } else if(_parameter_name.contains("_mood_")) { Mood _tag; String _mood_label = request.getParameter(_parameter_name); List _tags = RETRIEVER_TAG.retrieveMood(_mood_label); if(_tags.size() > 0) { _tag = (Mood)_tags.get(0); } else { URI representsResource = new URI(); //TODO setter une URI par l'admin representsResource.setEffectiveURI("http://www.uriprovisoirepourtag/mood/" + _mood_label); _tag = CREATOR_TAG.createAndGetMood(_mood_label, " ", APPLICATION_NAME, representsResource); } added.add(_tag); } } } /*SimpleTextStatus status_st = new RetrieveSimpleTextStatus().retrieveSimpleTextStatus("commentaire"); SimpleText st = CREATOR_SIMPLETEXT.createAndGetSimpleText(APPLICATION_NAME, status_st.getLabel() + " de l'annotation : " + annotation_title, access, request.getParameter("annotation_commentaire"), status_st); Collection<Resource> added = new ArrayList<Resource>(); added.add(st); */ //il faut récupérer la liste de sélections Collection<Resource> annotated = new ArrayList<Resource>(); for(Object _selection : _selections) { if(_selection instanceof HighlightSelectionHTML) { Resource _selection_origin = ((HighlightSelectionHTML)_selection).getSelection().getSelectionOrigin() ; if(_selection_origin instanceof WebPage) { URI _wp_access = ((WebPage)_selection_origin).getAccess(); CREATOR_URI.createURI(_wp_access.getEffectiveURI()); _wp_access = RETRIEVER_URI.retrieveURI(_wp_access.getEffectiveURI()); URI _wp_represents = ((WebPage)_selection_origin).getRepresentsResource(); CREATOR_URI.createURI(_wp_represents.getEffectiveURI()); _wp_represents = RETRIEVER_URI.retrieveURI(_wp_represents.getEffectiveURI()); URI _wp_principal = ((WebPage)_selection_origin).getPrincipalURL(); CREATOR_URI.createURI(_wp_principal.getEffectiveURI()); _wp_principal = RETRIEVER_URI.retrieveURI(_wp_principal.getEffectiveURI()); _selection_origin = CREATOR_HTML.createAndGetWebPage(_selection_origin.getLabel(), _selection_origin.getContextCreation(), ((WebPage) _selection_origin).getHTMLContent(), _wp_access, _wp_represents, _wp_principal); } else { URI _resource_represents = _selection_origin.getRepresentsResource(); CREATOR_URI.createURI(_resource_represents.getEffectiveURI()); _resource_represents = RETRIEVER_URI.retrieveURI(_resource_represents.getEffectiveURI()); _selection_origin = CREATOR_RESOURCE.createAndGetResource(_selection_origin.getContextCreation(), _selection_origin.getContextCreation(), _resource_represents); } URI _represents_selectionHTML = access ; //la même URI que pour l'annotation SelectionHTML _selectionHTML = CREATOR_SELECTIONHTML.createAndGetSelectionHTML( ((HighlightSelectionHTML)_selection).getSelection().getLabel(), ((HighlightSelectionHTML)_selection).getSelection().getContextCreation(), ((HighlightSelectionHTML)_selection).getSelection().getHTMLContent(), ((HighlightSelectionHTML)_selection).getSelection().getXpointerBegin(), ((HighlightSelectionHTML)_selection).getSelection().getXpointerEnd(), _represents_selectionHTML , _selection_origin); annotated.add(_selectionHTML); } else if(_selection instanceof WebPage) { URI _wp_access = ((WebPage)_selection).getAccess(); CREATOR_URI.createURI(_wp_access.getEffectiveURI()); _wp_access = RETRIEVER_URI.retrieveURI(_wp_access.getEffectiveURI()); URI _wp_represents = ((WebPage)_selection).getRepresentsResource(); CREATOR_URI.createURI(_wp_represents.getEffectiveURI()); _wp_represents = RETRIEVER_URI.retrieveURI(_wp_represents.getEffectiveURI()); URI _wp_principal = ((WebPage)_selection).getPrincipalURL(); CREATOR_URI.createURI(_wp_principal.getEffectiveURI()); _wp_principal = RETRIEVER_URI.retrieveURI(_wp_principal.getEffectiveURI()); WebPage _wp = CREATOR_HTML.createAndGetWebPage(((WebPage)_selection).getLabel(), ((WebPage)_selection).getContextCreation(), ((WebPage)_selection).getHTMLContent(), _wp_access, _wp_represents, _wp_principal); annotated.add(_wp); } else if(_selection instanceof Resource) { URI _represents_resource = ((Resource) _selection).getRepresentsResource(); CREATOR_URI.createURI(_represents_resource.getEffectiveURI()); _represents_resource = RETRIEVER_URI.retrieveURI(_represents_resource.getEffectiveURI()); Resource _resource = CREATOR_RESOURCE.createAndGetResource(((Resource) _selection).getContextCreation(), ((Resource) _selection).getLabel(), _represents_resource); annotated.add(_resource); } } if(_author != null) { System.out.println("[PortletCreateAnnotation.doCreateAnnotation] il y a un autheur"); System.out.println("[PortletCreateAnnotation.doCreateAnnotation] le nom de l'application " + APPLICATION_NAME); System.out.println("[PortletCreateAnnotation.doCreateAnnotation] status par défaut : " + default_status.getLabel()); //ajouter le status à la collection de status de l'utilisateur CREATOR_AGENT_STATUS.addAgentStatusToAgent(_author, default_status); //créer le tag est autheur TagAgent author_tag = CREATOR_TAG.createAndGetTagAgentIsAuthor(_author, APPLICATION_NAME, _author.getRepresents().getRepresentsResource(), default_status); if(author_tag.getId() == null) { author_tag = RETRIEVER_TAG.retrieveTagAgentIsAuthor(_author, default_status); } //ajouter le tag est autheur à l'annotation if(author_tag.getId() != null) { System.out.println("[PortletCreateAnnotation.doCreateAnnotation] add the TagAgent isAuthor to the annotation TagAgent id :" + author_tag.getId()); added.add(author_tag); } } CREATOR_ANNOTATION.createAnnotation(annotation_title, APPLICATION_NAME, access, access, status, added, annotated); } } } private void doCancel(ActionResponse response) throws PortletModeException { response.setPortletMode(PortletMode.VIEW); } private void doUpdate(ActionRequest request, ActionResponse response) throws ReadOnlyException, ValidatorException, IOException, PortletModeException { String url = request.getParameter("servlet-url"); boolean save = true ; if(url != null) { if (!StringOp.isValidURI(url)) { save = false; response.setRenderParameter("message", "not a valid URL"); System.out.println("[PortletCreateAnnotation.doUpdate] not a valid url : " + url); } if (save) { URL_SERVLET_ANNOTATIONS = url ; response.setPortletMode(PortletMode.VIEW); return; } response.setPortletMode(PortletMode.EDIT); } } private void doClearSelections(ActionRequest request, ActionResponse response) { if(request.getPortletSession().getAttribute("selections")!=null) { ArrayList _selections = (ArrayList) request.getPortletSession().getAttribute("selections") ; for(Object _selection : _selections) { if(_selection instanceof HighlightSelectionHTML) sendEvent("todelete", (HighlightSelectionHTML)_selection, response); } request.getPortletSession().removeAttribute("selections"); } } }
Je caste juste le event.getValue().
Le descripteur portlet.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
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 <?xml version="1.0" encoding="UTF-8"?> <portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"> <portlet> <portlet-name>PortletCreateAnnotation</portlet-name> <portlet-class>fr.natoine.PortletAnnotation.PortletCreateAnnotation</portlet-class> <supports> <mime-type>text/html</mime-type> <portlet-mode>VIEW</portlet-mode> <portlet-mode>HELP</portlet-mode> <portlet-mode>EDIT</portlet-mode> </supports> <portlet-info> <title>portlet de création des annotations</title> </portlet-info> <supported-processing-event> <qname>change_status</qname> </supported-processing-event> <supported-processing-event> <qname>UserLog</qname> </supported-processing-event> <supported-processing-event> <qname>selection</qname> </supported-processing-event> <supported-processing-event> <qname>page</qname> </supported-processing-event> <supported-processing-event> <qname>UserUnLog</qname> </supported-processing-event> <supported-processing-event> <qname>loadedurl</qname> </supported-processing-event> <supported-processing-event> <qname>default_url</qname> </supported-processing-event> <supported-publishing-event> <qname>tohighlight</qname> </supported-publishing-event> <supported-publishing-event> <qname>todelete</qname> </supported-publishing-event> </portlet> <portlet> <portlet-name>PortletWebBrowser</portlet-name> <portlet-class>fr.natoine.PortletBrowser.PortletWebBrowser</portlet-class> <supports> <mime-type>text/html</mime-type> <portlet-mode>VIEW</portlet-mode> <portlet-mode>EDIT</portlet-mode> </supports> <portlet-info> <title>WebBrowserPortlet</title> </portlet-info> <supported-publishing-event> <qname>selection</qname> </supported-publishing-event> <supported-publishing-event> <qname>page</qname> </supported-publishing-event> <supported-publishing-event> <qname>loadedurl</qname> </supported-publishing-event> <supported-publishing-event> <qname>default_url</qname> </supported-publishing-event> <supported-processing-event> <qname>toLoadUrl</qname> </supported-processing-event> <supported-processing-event> <qname>tohighlight</qname> </supported-processing-event> <supported-processing-event> <qname>todelete</qname> </supported-processing-event> </portlet> <event-definition> <qname>UserLog</qname> <value-type>fr.natoine.model_user.UserAccount</value-type> </event-definition> <event-definition> <qname>selection</qname> <value-type>fr.natoine.model_htmlDocs.HighlightSelectionHTML</value-type> </event-definition> <event-definition> <qname>page</qname> <value-type>fr.natoine.model_htmlDocs.WebPage</value-type> </event-definition> <event-definition> <qname>UserUnLog</qname> <value-type>java.lang.String</value-type> </event-definition> <event-definition> <qname>tohighlight</qname> <value-type>fr.natoine.model_htmlDocs.HighlightSelectionHTML</value-type> </event-definition> <event-definition> <qname>todelete</qname> <value-type>fr.natoine.model_htmlDocs.HighlightSelectionHTML</value-type> </event-definition> <event-definition> <qname>loadedurl</qname> <value-type>java.lang.String</value-type> </event-definition> <event-definition> <qname>default_url</qname> <value-type>java.lang.String</value-type> </event-definition> <event-definition> <qname>change_status</qname> <value-type>fr.natoine.model_annotation.AnnotationStatus</value-type> </event-definition> </portlet-app>
Désolé pour le retard, mais j'attendais d'en avoir besoin pour étudier ton code.
Merci pour l'exemple en tout cas, ca marche nickel![]()
Merci pour l'article !
Savez-vous s'il est possible d'envoyer un evenement à une portlet qui n'est pas sur la meme page ? (Je travaille sur Gatein)
Ou bien, formulé d'une autre façon, de dire à une portlet d ecouter un evenement alors que celle ci n est pas active
Merci d'avance et @+
Pour moi, c'est impossible.
Je passe par la session dans ces cas là.
Maintenant si un jour tu trouves que c'est faisable, je veux bien que tu me montres![]()
Vous avez un bloqueur de publicités installé.
Le Club Developpez.com n'affiche que des publicités IT, discrètes et non intrusives.
Afin que nous puissions continuer à vous fournir gratuitement du contenu de qualité, merci de nous soutenir en désactivant votre bloqueur de publicités sur Developpez.com.
Partager