Forum Stats

  • 3,840,307 Users
  • 2,262,585 Discussions
  • 7,901,207 Comments

Discussions

Need help in having a button switching a parameter value on mouse click in webcenter portal

khayal
khayal Member Posts: 34 Blue Ribbon

Hi All,

I am using webcenter portal 12.2.1.4 integrated with webcenter content. I am trying to design a functionality where I could change a parameter value in session-scope by mouse-click in the page-template. The ultimate goal is to use this parameter value later in a content presenter template using EL to decide whether to show certain types of files or not from the content server.

Here I created a bean (MyDocsBean) with a class and methods using the method builder in Action, and a public parameter and defaulted it to a Boolean value. I am trying to call in action or actionlistener a method to just toggle the parameter value. However, I am not able to see any change although I followed the method builder to identify and create the method being called in action. Have been battling with it for some days now. But it seems like the bean is not even instantiated and I really do not know that where in the template should I put to instantiate it.

I have used af:button in this case, and the parameter is like showMyDocs.

import ...;

   public class UpdateMyDocs implements Serializable {
      Boolean statusMyDocs;
   }

   public void updateMyDocs(ActionEvent actionEvent){
      if (getStatusMyDocs() != null && !getStatusMyDocs() ){
         setStatusMyDocs(true);
      } else {
        setStatusMyDocs(false);
      }
   }

   public void setStatusMyDocs(Boolean statusMyDocs){
      this.statusMyDocs = statusMyDocs;
   }

   public Boolean getStatusMyDocs(){
      return statusMyDocs;
   }
}

and this has been called in the button code in the page-template in its action as follows:

<af:button text="My Documents" id="pt_gmi1" action="#{MyDocsBean.updateMyDocs()}"/>


Several modified versions of code of this nature have been tried but with no desirable effect. Can someone please help me identify problems and get through this.

Many thanks!

Answers