0

I faced a interesting problem here. When I click commandButton, it calls wrong action method even button has not action attribute. What is this?

Odgiiv
  • 683
  • 1
  • 11
  • 32

1 Answers1

0

That may happen when the EL expression which you intented to use as a method expression is been evaluated as a value expression.

For example, when you have outcommented it using a HTML comment while not having configured Facelets to skip comments.

<!-- <h:commandButton value="submit" action="#{bean.submit()}" /> -->

The HTML comments namely doesn't stop EL expressions like #{bean.submit()} from being evaluated. It will ultimately generate HTML output with the return value of #{bean.submit()} inlined in the action attribute.

To naildown the root cause in your case, you should be creating and providing a fullworthy SSCCE.

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555