• Möglicherweise ist es einfach zu spät und erkenne meinen eigenen Fehler nicht. Nichts desto trotz habe ich einen und könnte da ein wenig Hilfe brauchen.

    Fehlermeldung im Browser ist wie folgt:
    /index.xhtml @13,79 type="de.jsfpraxis.events.ActionListener1" Couldn't qualify ActionListener
    Ich weiss nur nicht woran es genau liegt bzw. weiss ich noch nicht wirklich wozu ich dies de.jsfpraxis.events.... schreibe, ich arbeite gerade ein Buch durch und dies Thema war noch nicht dran. Hilfe dazu wäre super.

    Mein Code sieht folgendermaßen aus.:
    ---------------------------------------------------------------------------------------

    <?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://xmlns.jcp.org/jsf/html"
    xmlns:f="http://xmlns.jcp.org/jsf/core">
    <h:head>
    <title>Facelet Title</title>
    </h:head>
    <h:body>
    <h:panelGrid id="panel" columns="1">
    <h:inputTextarea id="textarea" rows="6" cols="50" value="#{aeHandler.text}"/>
    <h:commandButton id="button" value="OK" action="success">
    <f:actionListener type="de.jsfpraxis.events.ActionListener1"/>
    <f:actionListener type="de.jsfpraxis.events.ActionListener2"/>
    </h:commandButton>
    </h:panelGrid>
    Hello from Facelets
    </h:body>
    </html>

    ---------------------------------------------------------------------------------------

    package Actionss;


    import javax.faces.bean.ManagedBean;


    @ManagedBean(name = "aeHandler")
    public class ActionEventHandler {


    private String text = "";

    public String ok() {
    return "success";
    }


    public String getText() {
    return text;
    }


    public void setText(String text) {
    this.text = text;
    }
    }


    -------------------------------------------------------------------------------

    package Actionss;


    import java.util.List;
    import javax.annotation.ManagedBean;
    import javax.faces.bean.SessionScoped;
    import javax.faces.component.UIComponent;
    import javax.faces.component.html.HtmlInputTextarea;
    import javax.faces.event.AbortProcessingException;
    import javax.faces.event.ActionEvent;
    import javax.faces.event.ActionListener;
    import javax.xml.ws.handler.MessageContext.Scope;


    public class ActionListener1 implements ActionListener {

    public void processAction(ActionEvent ae)throws AbortProcessingException{
    HtmlInputTextarea text = null;
    List <UIComponent> components = ae.getComponent().getParent().getChildren();
    for(UIComponent element : components) {
    if(element.getId().equals("textarea")){
    text = (HtmlInputTextarea) element;
    }
    }
    text.setValue(text.getValue()+"processAction() von ActionListener1 aufgerufen.\n");
    }

    }


    --------------------------------------------------------------------------------------------------------

    package Actionss;
    import java.util.List;
    import javax.faces.component.UIComponent;
    import javax.faces.component.html.HtmlInputTextarea;
    import javax.faces.event.AbortProcessingException;
    import javax.faces.event.ActionEvent;
    import javax.faces.event.ActionListener;


    public class ActionListener2 implements ActionListener {
    public void processAction(ActionEvent ae)throws AbortProcessingException{
    HtmlInputTextarea text = null;
    List <UIComponent> components = ae.getComponent().getParent().getChildren();
    for(UIComponent element : components) {
    if(element.getId().equals("textarea")){
    text = (HtmlInputTextarea) element;
    }
    }
    text.setValue(text.getValue()+"processAction() von ActionListener2 aufgerufen.\n");
    }

    }

    ----------------------------------------------------------------------------------------------------------------------


    So nun gehe ich mal ne Runde die Augen zu machen... hoffe auf erfreuliche Antworten.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!