-
1. Re: rendered problem for commandButton
norman.richards Dec 24, 2006 10:15 AM (in response to vincecallagan)I cannot reproduce this. Being in a pageflow would not have any effect on whether or the rendered attribute works. There must be some other factor.
-
2. Re: rendered problem for commandButton
vincecallagan Dec 25, 2006 5:01 AM (in response to vincecallagan)here is the complete code :
<h:commandButton value="#{msgs.update}" action="update" rendered="#{!empty contact.name}"/> <h:commandButton value="#{msgs.createnewcontact}" action="addContact" rendered="#{empty contact.name}"/>
The second button works perfectly but pressing the first one does'nt produce anything :-(
I checked the code with firebugs and the page doesn't contain errors :-( -
3. Re: rendered problem for commandButton
norman.richards Dec 25, 2006 11:06 AM (in response to vincecallagan)I tried adding a rendered attribute to a button on the new user pageflow in the dvdstore. It worked exactly as expected. Can you post a larger example or maybe put it in the context of one of the existing examples?
Also, can you confirm your JSF version and Seam version? -
4. Re: rendered problem for commandButton
vincecallagan Dec 26, 2006 11:03 AM (in response to vincecallagan)I am using 1.1 GA with Jboss AS 4.05
The way I solved it for the moment is :rendered="#{contact.name!=''}"
-
5. Re: rendered problem for commandButton
margielm Oct 3, 2007 9:34 AM (in response to vincecallagan)Hi,
I am facing the same problem, and I have no idea how I can resolve it.
Quick view on something like my application:
I have xhtml:<h:form> <h:commandButton action="#{myControler.addNewItem}" value="add" rendered="#{param.mode == 'create'}" /> <h:commandButton action="#{myControler.updateItem}" value="update" rendered="#{param.mode == 'update'}" /> </h:form>
and controler:@Stateful @Name("myControler") public class MyControlerBean implements MyControler { public void addNewItem(){ logger.debug("entering adnewitem"); //rest of the method body } public void updateItem(){ logger.debug("entering updateitem"); //rest of the method body } }
And when mode parameter value is create or update on generated site everything seems to be ok, one button is displayed another is not- so exactly what I wanted to get.
BUT!!! When I click button no action is invoke. I don't see any log on jboss console.
What is wondering - when I write true/false explicate to rendered attribute everything is ok. Prefered action is invoked.
I am using jboss seam 1.2.1GA, Jboss AS 4.2.1 and JSF 1.2
Please help :) -
6. Re: rendered problem for commandButton
pmuir Oct 3, 2007 7:29 PM (in response to vincecallagan)Where does param.mode come from?
-
7. Re: rendered problem for commandButton
pmuir Oct 4, 2007 4:27 PM (in response to vincecallagan)Samuel just pointed me at the answer - the param is coming from the previous request. So when you submit the form (and it evalutates the rendered expression to check whether the button push is valid) the param isn't available (it's the next request).
I would suggest pushing (e.g. in pages.xml, a @Factory) your param.mode variable into page scope when the page is loaded, then it will be there when you submit the page.
Alternatively you can use a h:commandLink with a nested f:param to propagate the parameter. -
8. Re: rendered problem for commandButton
margielm Oct 5, 2007 5:30 AM (in response to vincecallagan)"pete.muir@jboss.org" wrote:
I would suggest pushing (e.g. <out /> in pages.xml, a @Factory) your param.mode variable into page scope when the page is loaded, then it will be there when you submit the page.
Hi.
thanks for your answer, but can you give my some exaple of pushing variable into page scope in pages.xml. Because I don't realy know what do you mean.