Is there a way to pass a variable into a method param:
<h:commandButton value="Add to Order"
actionListener="#{orderBasket.addItems(currentItem.id)}"/>
This always seems to pass 0 into the method for some reason.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
That’s only possible when you use
actioninstead ofactionListenerand you’re running a Servlet 3.0 / EL 2.2 capable container (Tomcat 7, Glassfish 3, JBoss 6, etc) and your
web.xmlis declared conform Servlet 3.0 spec with the following root declarationIf the latter two are not true for your case (e.g. you’re using Servlet 2.5), then you need to replace the EL implementation by another one which supports that, such as JBoss EL. For detail, see this answer.