Bonjour,
Le bouton ne déclenche pas la methode "run" du bean, quelqu'un peu m'aider, je ne comprends pas pourquoi ?
Je récupére bien le lib du bouton.
J'ai testé avec ActionListern, Action, "#{calculs.run}" ou action="#{calculs.run()}"
mon beanet la page .xhtml
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 package com.site.forms.calcul; import java.io.Serializable; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; import com.site.outil.image.ImageOeil; @ManagedBean(name = "calculs") @SessionScoped public class Calculs implements Serializable { private String lib; /** * */ private static final long serialVersionUID = 1L; public Calculs() { System.out.println("Calculs"); lib="lancer"; } public String run () { //ImageOeil iOeil = new ImageOeil(); System.out.println("run"); //iOeil.ligne(); // iOeil.savepng("c:\\temps\\test.png"); return "IMAGE"; } public String getLib() { return lib; } public void setLib(String lib) { this.lib = lib; } }
merci
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 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:p="http://primefaces.org/ui"> <h:head> <ui:include src="blocs/header.xhtml"></ui:include> </h:head> <h:body> page index <h:form> <p:commandButton type="button" action="#{calculs.run}" value="${calculs.lib}" ajax="false" styleClass="ui-priority-primary" /> </h:form> </h:body> </html>
Partager