1

I am trying to invoke a managed bean method called getNebulizerModelName in the action attribute of a <h:commandLink> in my facelet page, so that i can tell the implicit NavigationHandler where to go next according to the faces-config.xml navigation rules. But i get the depicted error above. Method is there and it complies to the rules stated in the tag library documentation. It's worth noticing that other methods from the same managed bean are found and invoked just fine as you can see in the code below. I have searched relevant posts for about an hour now. I have tried cleaning, building again, restarting the server, closing and opening the IDE. I am using:

  • GlasshFish 4.1
  • Java EE 7
  • jsf 2.1
  • mojarra 2.3
  • NetBeans 8.2

Facelet page:

<h:form>
   <ul class="catGridList">
      <ui:repeat value="#{productManager.nebulizers}" var="nebulizer">
         <li class="catGridListItem">
            <h:commandLink action="#{productManager.nebulizerModelName}">
               <h:graphicImage class="catGridListImg" library="img" name="#{nebulizer.imageSrc}"/>
            </h:commandLink>
         </li>
      </ui:repeat>
   </ul>
</h:form>

Managed Bean Class:

@ManagedBean(name="productManager")
@SessionScoped
public class ProductManager implements Serializable {
   private static final long serialVersionUID = 5874124596321L;
   private final Logger logger = Logger.getLogger("xaris.web.ProductManager");
   private List<Nebulizer> nebulizers;
   private Nebulizer nebulizer;
   private String nebulizerModelName;
   @EJB
   private RequestBean request;

   public List<Nebulizer> getNebulizers() {
      try {
         this.nebulizers = request.getNebulizers();
      }catch(Exception ex) {
         logger.warning("Could not get nebulizers");
      }
      return nebulizers;
   }

   public String getNebulizerModelName() {
      try {
         nebulizerModelName = request.getNebulizerModelName();
      } catch(Exception ex) {
         ogger.warning("Could not get specific model name.");
      }
      switch(nebulizerModelName) {
         case "Flo Eolo":
            nebulizerModelName = "flo_eolo";
            break;
         case "Flo Miko":
            nebulizerModelName = "flo_miko";
            break;
         default:
            nebulizerModelName = "";
            break;
      }
      return nebulizerModelName;
   }
}

Any suggestions?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Xaris
  • 23
  • 6
  • An action is not an attribute, hence you should write #{productManager.getNebulizerModelName} – siom Aug 10 '17 at 11:47
  • Suggestion: start by reading all >40 upvoted (https://stackoverflow.com/questions/tagged/jsf?sort=votes) Q/A that have JSF as a tag and memorizing their existence. – Kukeltje Aug 10 '17 at 12:01
  • What do you mean exactly? Its listed as an attribute in the tag library documentation. I tried it, but still i get the same exception. I also think its not a duplicate, because the referenced question is about passing form input values to the bean. I am trying to define navigation here. – Xaris Aug 10 '17 at 12:11

0 Answers0