Reputation: 10273
I need to do something like this:
<a4j:support even="onclick" action="#{myBean.myProperty = null}"/>
I would like to know if this is possible and which would be the proper syntax if so.
Upvotes: 1
Views: 3982
Reputation: 1108922
If you're running an EL 2.2 capable container (Tomcat 7, Glassfish 3, JBoss AS 6, etc and newer, with a web.xml
declared conform at least Servlet 3.0), or are using JBoss EL (your seam
tag suggests that you are using it...), then you should be able to invoke methods with arguments in EL:
<a4j:support event="onclick" action="#{myBean.setMyProperty(null)}"/>
An alternative is using <f:setPropertyActionListener>
, this is supported in JSF 1.2 as well:
<a4j:support event="onclick" />
<f:setPropertyActionListener target="#{myBean.myProperty}" value="#{null}" />
Upvotes: 2
Reputation: 3008
Bean setter methods are called on form submission but based on your example why not do something like:
<a4j:support event="onclick" action="#{myBean.resetMyProperty}"/>
And in your bean your resetMyProperty method would set the myProperty to null
Upvotes: 1