0 Replies Latest reply on Feb 21, 2014 8:12 AM by Leandro Fracaro

    How to call a method in Bean onClick in the save button on rich:editor using RichFaces 4?

    Leandro Fracaro Newbie

      I am using the RichFaces 4 in my application, but I`d like call a method from my bean when the user press the save button (for example: to save in a file text.txt)

      Is there a way to call a java method when the user click on the tollbar save button (disket)?

      Here is the code i`m using

      <?xml version="1.0" encoding="ISO-8859-1" ?>
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
      html xmlns="http://www.w3.org/1999/xhtml"
      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
      <title>Insert title here</title>

      <rich:editor id="editor" toolbar="full" value="#{editorBean.value}" style="margin-bottom: 1em" height="400" >

      <a4j:ajax event="change" render="panel"  status="panelUpdateStatus" />

      <a4j:ajax event="dirty" render="panel" status="panelUpdateStatus">
      <a4j:attachQueue requestDelay="1000" />


      <rich:panel id="panel">
      <f:facet name="header">
      Output from Editor
      <a4j:status name="panelUpdateStatus">
      <f:facet name="start">
      <h:outputText escape="false" value="#{editorBean.value}" />




      import java.io.Serializable;

      import javax.enterprise.context.SessionScoped;
      import javax.inject.Named;

      public class EditorBean implements Serializable{


      private static final long serialVersionUID = 5383915229820571701L;

      private String value;

      * @return the value

      public String getValue() {
      return value;

      * @param value the value to set

      public void setValue(String value) {
      this.value = value;

      public void save(){
      System.out.println(" Saving ");
      //Code to save