Re: commandlink not working in panelgrid

2012-05-10 Thread Mike Kienenberger
This is one of the basic concepts that you learn as you work with JSF
-- for a UICommand component to perform its action, it must be
rendered on the initial view, and it must also be rendered on the view
created to process the submit.

So whatever condition you use for rendered must involve objects that
exist longer than request scope.

Also, static class variables are not available for use in the EL
expression.   I believe non-public class instance variables are also
not available, but I think public ones are.   To be on the safe side,
you should provide a bean getter for any variable you want to access
from the EL expression.

So for resources.LOGIN_TYPE_MY_ACCOUNT to work, you would need to
provide a getLOGIN_TYPE_MY_ACCOUNT() { return LOGIN_TYPE_MY_ACCOUNT; }
method on your resources bean.


On Wed, May 9, 2012 at 4:46 PM, Lim Hock-Chai
lim.hock-c...@usamobility.com wrote:
 I should probably clarify by saying, it shows the link but just will not fire 
 the action when click on it.  Another word, the rendered test is successful 
 on panelgrid (hence the link is shown), but the test failed when clicked on 
 the link.  Scratch my head on this for two days.  Learn a new 
 tricks-of-the-trade, priceless...



 -Original Message-
 From: Lim Hock-Chai [mailto:lim.hock-c...@usamobility.com]
 Sent: Wednesday, May 09, 2012 3:36 PM
 To: MyFaces Discussion
 Subject: RE: commandlink not working in panelgrid

 Finally got it to work inside panelgrid.  I don't understand it but it works. 
  Shasi, I think you are right about the problem is caused by rendered 
 attribute being evaluated as false when clicked.  Below is what I did to get 
 it to work.  Hopefully you or someone can explain why.

 The code change that I made to get it to work is on this line only:
 h:panelGrid  rendered=#{not empty sessionScope.MyAccountLoginType and 
 sessionScope.MyAccountLoginType==resources.LOGIN_TYPE_MY_ACCOUNT }

 It works if I change it to this:
 h:panelGrid  rendered=#{ sessionScope.MyAccountLoginType=='MA'}
 Note : value of MA is what I have in my message bundle 
 resources.LOGIN_TYPE_MY_ACCOUNT.  Just to be sure, I did h:outputText 
 value=#{resources.LOGIN_TYPE_MY_ACCOUNT} / and it output value of MA 
 correctly.  Not sure why I can't use it to perform the rendered test.

 I tried below and non of them work.  But I don't know why:
 h:panelGrid  rendered=#{not empty sessionScope.MyAccountLoginType and 
 sessionScope.MyAccountLoginType==resources.LOGIN_TYPE_MY_ACCOUNT }

 h:panelGrid  rendered=#{not empty sessionScope.MyAccountLoginType and 
 sessionScope.MyAccountLoginType=='MA' }

 h:panelGrid  rendered=${not empty sessionScope.MyAccountLoginType and 
 sessionScope.MyAccountLoginType=='MA' }


 -Original Message-
 From: Lim Hock-Chai [mailto:lim.hock-c...@usamobility.com]
 Sent: Wednesday, May 09, 2012 1:52 PM
 To: MyFaces Discussion
 Subject: RE: commandlink not working in panelgrid

 I added an onclick=alert(#{not empty sessionScope.MyAccountLoginType and 
 sessionScope.MyAccountLoginType==resources.LOGIN_TYPE_MY_ACCOUNT }) on the 
 commandlink element and the alert showing value of true when I click on the 
 link.


                h:panelGrid
                                rendered=#{not empty 
 sessionScope.MyAccountLoginType and
                                                                        
 sessionScope.MyAccountLoginType==resources.LOGIN_TYPE_MY_ACCOUNT }
                        h:outputText value= /
                        h:outputText value=|/
                        h:commandLink
                                immediate=true
                                onclick=alert(#{not empty 
 sessionScope.MyAccountLoginType and 
 sessionScope.MyAccountLoginType==resources.LOGIN_TYPE_MY_ACCOUNT })
                                style=CURSOR: pointer
                                
 action=#{commonTaskBean.fromMSAMBackToMyAccount}
                                h:outputText value=My Account/
                        /h:commandLink
                        h:outputText value=|/
                /h:panelGrid

 -Original Message-
 From: Shasi Mitra [mailto:shasimi...@yahoo.com]
 Sent: Wednesday, May 09, 2012 1:36 PM
 To: MyFaces Discussion
 Subject: Re: commandlink not working in panelgrid

 After u click the link also the expression in the rendered attribute is 
 evaluated. That time it should be returning Faldo and hence ur action isn't 
 being fired. If u remove all the rendered attributes or keep ur bean in 
 session scope, it should work. Try printing the expression u gave in the 
 rendered attribute and check.

 Sent from my iPhone

 On May 9, 2012, at 11:59 PM, Lim Hock-Chai lim.hock-c...@usamobility.com 
 wrote:

 I tried both session and request scopes.  Both failed to work.  The thing is 
 that the commandlink is showing on the page, which would mean that the 
 rendered condition in the panelGroup or panelgrid is ok.  It just that when 
 I click on the link that is inside

Re: commandlink not working in panelgrid

2012-05-09 Thread Shasi Mitra
Are u sure ur bean is in session scope? Befor the action event is fired, it's 
verified whether the grid is rendered or not. So if the bean is in request 
scope, it returns False and therefore the link's action isn't fired. 

Sent from my iPhone

On May 9, 2012, at 9:57 PM, Lim Hock-Chai lim.hock-c...@usamobility.com wrote:

 I'm currently using myfaces 1.1.9 for my web app.  I'm having some problems 
 with commandlink not working correctly for me.  It appears that when 
 commandlink is inside of the panelgrid, it is not calling the method 
 specified in the action attr.  But it works fine if I put it outside of the 
 panelgrid.  Strange part is that I've had other jsp that have commandlink 
 inside datatable and they work fine also.  This is the first time I use it 
 inside a panelgrid.
 
 See code below.  The first commandlink is, which is not inside of panelgrid, 
 works fine.  The 2nd commandlink is inside of panelgrid and it is not working 
 (not calling back-end bean method)
 
 jsp:root version=2.0
xmlns:jsp=http://java.sun.com/JSP/Page;
 xmlns:c=http://java.sun.com/jsp/jstl/core;
 xmlns:f=http://java.sun.com/jsf/core;
 xmlns:h=http://java.sun.com/jsf/html;
 xmlns:t=http://myfaces.apache.org/tomahawk;
 xmlns:a4j=http://richfaces.org/a4j;
 
 f:subview
f:loadBundle var=resources basename=com.arch.myaccount.jsf.Resources/
h:form id=MSAMHeaderOtherForm
 
!-- commandlink below works fine --
h:outputText value=|/
h:commandLink  immediate=true style=CURSOR: pointer  
 action=#{commonTaskBean.fromMSAMBackToMyAccount} 
h:outputText value=My Account/
/h:commandLink
h:outputText value=|/
 
!-- commandlink below does not work --
h:panelGroup  
rendered=#{not empty sessionScope.MyAccountLoginType and

 sessionScope.MyAccountLoginType==resources.LOGIN_TYPE_MY_ACCOUNT }
h:outputText value= /
h:outputText value=|/
h:commandLink  immediate=true style=CURSOR: pointer  
 action=#{commonTaskBean.fromMSAMBackToMyAccount}
h:outputText value=My Account/
/h:commandLink
h:outputText value=|/
/h:panelGroup
/h:form
 /f:subview
 /jsp:root


RE: commandlink not working in panelgrid

2012-05-09 Thread Lim Hock-Chai
I tried both session and request scopes.  Both failed to work.  The thing is 
that the commandlink is showing on the page, which would mean that the rendered 
condition in the panelGroup or panelgrid is ok.  It just that when I click on 
the link that is inside the panelgroup/panelgrid, it does not work.  I even 
tried not using any rendered condition on the panelGroup/panelGrid, the link 
still not working.  Oddest thing.



-Original Message-
From: Shasi Mitra [mailto:shasimi...@yahoo.com] 
Sent: Wednesday, May 09, 2012 1:12 PM
To: MyFaces Discussion
Subject: Re: commandlink not working in panelgrid

Are u sure ur bean is in session scope? Befor the action event is fired, it's 
verified whether the grid is rendered or not. So if the bean is in request 
scope, it returns False and therefore the link's action isn't fired. 

Sent from my iPhone

On May 9, 2012, at 9:57 PM, Lim Hock-Chai lim.hock-c...@usamobility.com wrote:

 I'm currently using myfaces 1.1.9 for my web app.  I'm having some problems 
 with commandlink not working correctly for me.  It appears that when 
 commandlink is inside of the panelgrid, it is not calling the method 
 specified in the action attr.  But it works fine if I put it outside of the 
 panelgrid.  Strange part is that I've had other jsp that have commandlink 
 inside datatable and they work fine also.  This is the first time I use it 
 inside a panelgrid.
 
 See code below.  The first commandlink is, which is not inside of panelgrid, 
 works fine.  The 2nd commandlink is inside of panelgrid and it is not working 
 (not calling back-end bean method)
 
 jsp:root version=2.0
xmlns:jsp=http://java.sun.com/JSP/Page;
 xmlns:c=http://java.sun.com/jsp/jstl/core;
 xmlns:f=http://java.sun.com/jsf/core;
 xmlns:h=http://java.sun.com/jsf/html;
 xmlns:t=http://myfaces.apache.org/tomahawk;
 xmlns:a4j=http://richfaces.org/a4j;
 
 f:subview
f:loadBundle var=resources basename=com.arch.myaccount.jsf.Resources/
h:form id=MSAMHeaderOtherForm
 
!-- commandlink below works fine --
h:outputText value=|/
h:commandLink  immediate=true style=CURSOR: pointer  
 action=#{commonTaskBean.fromMSAMBackToMyAccount} 
h:outputText value=My Account/
/h:commandLink
h:outputText value=|/
 
!-- commandlink below does not work --
h:panelGroup  
rendered=#{not empty sessionScope.MyAccountLoginType and

 sessionScope.MyAccountLoginType==resources.LOGIN_TYPE_MY_ACCOUNT }
h:outputText value= /
h:outputText value=|/
h:commandLink  immediate=true style=CURSOR: pointer  
 action=#{commonTaskBean.fromMSAMBackToMyAccount}
h:outputText value=My Account/
/h:commandLink
h:outputText value=|/
/h:panelGroup
/h:form
 /f:subview
 /jsp:root


Re: commandlink not working in panelgrid

2012-05-09 Thread Shasi Mitra
After u click the link also the expression in the rendered attribute is 
evaluated. That time it should be returning Faldo and hence ur action isn't 
being fired. If u remove all the rendered attributes or keep ur bean in session 
scope, it should work. Try printing the expression u gave in the rendered 
attribute and check. 

Sent from my iPhone

On May 9, 2012, at 11:59 PM, Lim Hock-Chai lim.hock-c...@usamobility.com 
wrote:

 I tried both session and request scopes.  Both failed to work.  The thing is 
 that the commandlink is showing on the page, which would mean that the 
 rendered condition in the panelGroup or panelgrid is ok.  It just that when I 
 click on the link that is inside the panelgroup/panelgrid, it does not work.  
 I even tried not using any rendered condition on the panelGroup/panelGrid, 
 the link still not working.  Oddest thing.
 
 
 
 -Original Message-
 From: Shasi Mitra [mailto:shasimi...@yahoo.com] 
 Sent: Wednesday, May 09, 2012 1:12 PM
 To: MyFaces Discussion
 Subject: Re: commandlink not working in panelgrid
 
 Are u sure ur bean is in session scope? Befor the action event is fired, it's 
 verified whether the grid is rendered or not. So if the bean is in request 
 scope, it returns False and therefore the link's action isn't fired. 
 
 Sent from my iPhone
 
 On May 9, 2012, at 9:57 PM, Lim Hock-Chai lim.hock-c...@usamobility.com 
 wrote:
 
 I'm currently using myfaces 1.1.9 for my web app.  I'm having some problems 
 with commandlink not working correctly for me.  It appears that when 
 commandlink is inside of the panelgrid, it is not calling the method 
 specified in the action attr.  But it works fine if I put it outside of the 
 panelgrid.  Strange part is that I've had other jsp that have commandlink 
 inside datatable and they work fine also.  This is the first time I use it 
 inside a panelgrid.
 
 See code below.  The first commandlink is, which is not inside of panelgrid, 
 works fine.  The 2nd commandlink is inside of panelgrid and it is not 
 working (not calling back-end bean method)
 
 jsp:root version=2.0
   xmlns:jsp=http://java.sun.com/JSP/Page;
xmlns:c=http://java.sun.com/jsp/jstl/core;
xmlns:f=http://java.sun.com/jsf/core;
xmlns:h=http://java.sun.com/jsf/html;
xmlns:t=http://myfaces.apache.org/tomahawk;
xmlns:a4j=http://richfaces.org/a4j;
 
 f:subview
   f:loadBundle var=resources basename=com.arch.myaccount.jsf.Resources/
   h:form id=MSAMHeaderOtherForm
 
   !-- commandlink below works fine --
   h:outputText value=|/
   h:commandLink  immediate=true style=CURSOR: pointer  
 action=#{commonTaskBean.fromMSAMBackToMyAccount} 
   h:outputText value=My Account/
   /h:commandLink
   h:outputText value=|/
 
   !-- commandlink below does not work --
   h:panelGroup  
   rendered=#{not empty sessionScope.MyAccountLoginType and
   
 sessionScope.MyAccountLoginType==resources.LOGIN_TYPE_MY_ACCOUNT }
   h:outputText value= /
   h:outputText value=|/
   h:commandLink  immediate=true style=CURSOR: pointer  
 action=#{commonTaskBean.fromMSAMBackToMyAccount}
   h:outputText value=My Account/
   /h:commandLink
   h:outputText value=|/
   /h:panelGroup
   /h:form
 /f:subview
 /jsp:root


RE: commandlink not working in panelgrid

2012-05-09 Thread Lim Hock-Chai
I added an onclick=alert(#{not empty sessionScope.MyAccountLoginType and 
sessionScope.MyAccountLoginType==resources.LOGIN_TYPE_MY_ACCOUNT }) on the 
commandlink element and the alert showing value of true when I click on the 
link.


h:panelGrid  
rendered=#{not empty 
sessionScope.MyAccountLoginType and

sessionScope.MyAccountLoginType==resources.LOGIN_TYPE_MY_ACCOUNT }
h:outputText value= /
h:outputText value=|/
h:commandLink  
immediate=true 
onclick=alert(#{not empty 
sessionScope.MyAccountLoginType and 
sessionScope.MyAccountLoginType==resources.LOGIN_TYPE_MY_ACCOUNT }) 
style=CURSOR: pointer  

action=#{commonTaskBean.fromMSAMBackToMyAccount}
h:outputText value=My Account/
/h:commandLink
h:outputText value=|/
/h:panelGrid

-Original Message-
From: Shasi Mitra [mailto:shasimi...@yahoo.com] 
Sent: Wednesday, May 09, 2012 1:36 PM
To: MyFaces Discussion
Subject: Re: commandlink not working in panelgrid

After u click the link also the expression in the rendered attribute is 
evaluated. That time it should be returning Faldo and hence ur action isn't 
being fired. If u remove all the rendered attributes or keep ur bean in session 
scope, it should work. Try printing the expression u gave in the rendered 
attribute and check. 

Sent from my iPhone

On May 9, 2012, at 11:59 PM, Lim Hock-Chai lim.hock-c...@usamobility.com 
wrote:

 I tried both session and request scopes.  Both failed to work.  The thing is 
 that the commandlink is showing on the page, which would mean that the 
 rendered condition in the panelGroup or panelgrid is ok.  It just that when I 
 click on the link that is inside the panelgroup/panelgrid, it does not work.  
 I even tried not using any rendered condition on the panelGroup/panelGrid, 
 the link still not working.  Oddest thing.
 
 
 
 -Original Message-
 From: Shasi Mitra [mailto:shasimi...@yahoo.com] 
 Sent: Wednesday, May 09, 2012 1:12 PM
 To: MyFaces Discussion
 Subject: Re: commandlink not working in panelgrid
 
 Are u sure ur bean is in session scope? Befor the action event is fired, it's 
 verified whether the grid is rendered or not. So if the bean is in request 
 scope, it returns False and therefore the link's action isn't fired. 
 
 Sent from my iPhone
 
 On May 9, 2012, at 9:57 PM, Lim Hock-Chai lim.hock-c...@usamobility.com 
 wrote:
 
 I'm currently using myfaces 1.1.9 for my web app.  I'm having some problems 
 with commandlink not working correctly for me.  It appears that when 
 commandlink is inside of the panelgrid, it is not calling the method 
 specified in the action attr.  But it works fine if I put it outside of the 
 panelgrid.  Strange part is that I've had other jsp that have commandlink 
 inside datatable and they work fine also.  This is the first time I use it 
 inside a panelgrid.
 
 See code below.  The first commandlink is, which is not inside of panelgrid, 
 works fine.  The 2nd commandlink is inside of panelgrid and it is not 
 working (not calling back-end bean method)
 
 jsp:root version=2.0
   xmlns:jsp=http://java.sun.com/JSP/Page;
xmlns:c=http://java.sun.com/jsp/jstl/core;
xmlns:f=http://java.sun.com/jsf/core;
xmlns:h=http://java.sun.com/jsf/html;
xmlns:t=http://myfaces.apache.org/tomahawk;
xmlns:a4j=http://richfaces.org/a4j;
 
 f:subview
   f:loadBundle var=resources basename=com.arch.myaccount.jsf.Resources/
   h:form id=MSAMHeaderOtherForm
 
   !-- commandlink below works fine --
   h:outputText value=|/
   h:commandLink  immediate=true style=CURSOR: pointer  
 action=#{commonTaskBean.fromMSAMBackToMyAccount} 
   h:outputText value=My Account/
   /h:commandLink
   h:outputText value=|/
 
   !-- commandlink below does not work --
   h:panelGroup  
   rendered=#{not empty sessionScope.MyAccountLoginType and
   
 sessionScope.MyAccountLoginType==resources.LOGIN_TYPE_MY_ACCOUNT }
   h:outputText value= /
   h:outputText value=|/
   h:commandLink  immediate=true style=CURSOR: pointer  
 action=#{commonTaskBean.fromMSAMBackToMyAccount}
   h:outputText value=My Account/
   /h:commandLink
   h:outputText value=|/
   /h:panelGroup
   /h:form
 /f:subview
 /jsp:root


RE: commandlink not working in panelgrid

2012-05-09 Thread Lim Hock-Chai
Finally got it to work inside panelgrid.  I don't understand it but it works.  
Shasi, I think you are right about the problem is caused by rendered attribute 
being evaluated as false when clicked.  Below is what I did to get it to work.  
Hopefully you or someone can explain why.

The code change that I made to get it to work is on this line only:
h:panelGrid  rendered=#{not empty sessionScope.MyAccountLoginType and 
sessionScope.MyAccountLoginType==resources.LOGIN_TYPE_MY_ACCOUNT }  

It works if I change it to this:
h:panelGrid  rendered=#{ sessionScope.MyAccountLoginType=='MA'}   
Note : value of MA is what I have in my message bundle 
resources.LOGIN_TYPE_MY_ACCOUNT.  Just to be sure, I did h:outputText 
value=#{resources.LOGIN_TYPE_MY_ACCOUNT} / and it output value of MA 
correctly.  Not sure why I can't use it to perform the rendered test.

I tried below and non of them work.  But I don't know why:
h:panelGrid  rendered=#{not empty sessionScope.MyAccountLoginType and 
sessionScope.MyAccountLoginType==resources.LOGIN_TYPE_MY_ACCOUNT }  

h:panelGrid  rendered=#{not empty sessionScope.MyAccountLoginType and 
sessionScope.MyAccountLoginType=='MA' } 

h:panelGrid  rendered=${not empty sessionScope.MyAccountLoginType and 
sessionScope.MyAccountLoginType=='MA' } 

 
-Original Message-
From: Lim Hock-Chai [mailto:lim.hock-c...@usamobility.com] 
Sent: Wednesday, May 09, 2012 1:52 PM
To: MyFaces Discussion
Subject: RE: commandlink not working in panelgrid

I added an onclick=alert(#{not empty sessionScope.MyAccountLoginType and 
sessionScope.MyAccountLoginType==resources.LOGIN_TYPE_MY_ACCOUNT }) on the 
commandlink element and the alert showing value of true when I click on the 
link.


h:panelGrid  
rendered=#{not empty 
sessionScope.MyAccountLoginType and

sessionScope.MyAccountLoginType==resources.LOGIN_TYPE_MY_ACCOUNT }
h:outputText value= /
h:outputText value=|/
h:commandLink  
immediate=true 
onclick=alert(#{not empty 
sessionScope.MyAccountLoginType and 
sessionScope.MyAccountLoginType==resources.LOGIN_TYPE_MY_ACCOUNT }) 
style=CURSOR: pointer  

action=#{commonTaskBean.fromMSAMBackToMyAccount}
h:outputText value=My Account/
/h:commandLink
h:outputText value=|/
/h:panelGrid

-Original Message-
From: Shasi Mitra [mailto:shasimi...@yahoo.com] 
Sent: Wednesday, May 09, 2012 1:36 PM
To: MyFaces Discussion
Subject: Re: commandlink not working in panelgrid

After u click the link also the expression in the rendered attribute is 
evaluated. That time it should be returning Faldo and hence ur action isn't 
being fired. If u remove all the rendered attributes or keep ur bean in session 
scope, it should work. Try printing the expression u gave in the rendered 
attribute and check. 

Sent from my iPhone

On May 9, 2012, at 11:59 PM, Lim Hock-Chai lim.hock-c...@usamobility.com 
wrote:

 I tried both session and request scopes.  Both failed to work.  The thing is 
 that the commandlink is showing on the page, which would mean that the 
 rendered condition in the panelGroup or panelgrid is ok.  It just that when I 
 click on the link that is inside the panelgroup/panelgrid, it does not work.  
 I even tried not using any rendered condition on the panelGroup/panelGrid, 
 the link still not working.  Oddest thing.
 
 
 
 -Original Message-
 From: Shasi Mitra [mailto:shasimi...@yahoo.com] 
 Sent: Wednesday, May 09, 2012 1:12 PM
 To: MyFaces Discussion
 Subject: Re: commandlink not working in panelgrid
 
 Are u sure ur bean is in session scope? Befor the action event is fired, it's 
 verified whether the grid is rendered or not. So if the bean is in request 
 scope, it returns False and therefore the link's action isn't fired. 
 
 Sent from my iPhone
 
 On May 9, 2012, at 9:57 PM, Lim Hock-Chai lim.hock-c...@usamobility.com 
 wrote:
 
 I'm currently using myfaces 1.1.9 for my web app.  I'm having some problems 
 with commandlink not working correctly for me.  It appears that when 
 commandlink is inside of the panelgrid, it is not calling the method 
 specified in the action attr.  But it works fine if I put it outside of the 
 panelgrid.  Strange part is that I've had other jsp that have commandlink 
 inside datatable and they work fine also.  This is the first time I use it 
 inside a panelgrid.
 
 See code below.  The first commandlink is, which is not inside of panelgrid, 
 works fine.  The 2nd commandlink is inside of panelgrid and it is not 
 working (not calling back-end bean method)
 
 jsp:root version=2.0
   xmlns:jsp=http://java.sun.com/JSP/Page;
xmlns:c=http

Re: commandlink not working in panelgrid

2012-05-09 Thread Thomas Andraschko
I also had this problem month's ago and i don't like :)
Maybe it would be better if rendered attribute evaluation would be skipped
for the action-source component.
But don't know if this would have some side effects.

2012/5/9 Lim Hock-Chai lim.hock-c...@usamobility.com

 Finally got it to work inside panelgrid.  I don't understand it but it
 works.  Shasi, I think you are right about the problem is caused by
 rendered attribute being evaluated as false when clicked.  Below is what I
 did to get it to work.  Hopefully you or someone can explain why.

 The code change that I made to get it to work is on this line only:
 h:panelGrid  rendered=#{not empty sessionScope.MyAccountLoginType and
 sessionScope.MyAccountLoginType==resources.LOGIN_TYPE_MY_ACCOUNT }

 It works if I change it to this:
 h:panelGrid  rendered=#{ sessionScope.MyAccountLoginType=='MA'}
 Note : value of MA is what I have in my message bundle
 resources.LOGIN_TYPE_MY_ACCOUNT.  Just to be sure, I did h:outputText
 value=#{resources.LOGIN_TYPE_MY_ACCOUNT} / and it output value of MA
 correctly.  Not sure why I can't use it to perform the rendered test.

 I tried below and non of them work.  But I don't know why:
 h:panelGrid  rendered=#{not empty sessionScope.MyAccountLoginType and
 sessionScope.MyAccountLoginType==resources.LOGIN_TYPE_MY_ACCOUNT }

 h:panelGrid  rendered=#{not empty sessionScope.MyAccountLoginType and
 sessionScope.MyAccountLoginType=='MA' }

 h:panelGrid  rendered=${not empty sessionScope.MyAccountLoginType and
 sessionScope.MyAccountLoginType=='MA' }


 -Original Message-
 From: Lim Hock-Chai [mailto:lim.hock-c...@usamobility.com]
 Sent: Wednesday, May 09, 2012 1:52 PM
 To: MyFaces Discussion
 Subject: RE: commandlink not working in panelgrid

 I added an onclick=alert(#{not empty sessionScope.MyAccountLoginType and
 sessionScope.MyAccountLoginType==resources.LOGIN_TYPE_MY_ACCOUNT }) on the
 commandlink element and the alert showing value of true when I click on the
 link.


h:panelGrid
rendered=#{not empty
 sessionScope.MyAccountLoginType and

  sessionScope.MyAccountLoginType==resources.LOGIN_TYPE_MY_ACCOUNT }
h:outputText value= /
h:outputText value=|/
h:commandLink
immediate=true
onclick=alert(#{not empty
 sessionScope.MyAccountLoginType and
 sessionScope.MyAccountLoginType==resources.LOGIN_TYPE_MY_ACCOUNT })
style=CURSOR: pointer

  action=#{commonTaskBean.fromMSAMBackToMyAccount}
h:outputText value=My Account/
/h:commandLink
h:outputText value=|/
/h:panelGrid

 -Original Message-
 From: Shasi Mitra [mailto:shasimi...@yahoo.com]
 Sent: Wednesday, May 09, 2012 1:36 PM
 To: MyFaces Discussion
 Subject: Re: commandlink not working in panelgrid

 After u click the link also the expression in the rendered attribute is
 evaluated. That time it should be returning Faldo and hence ur action isn't
 being fired. If u remove all the rendered attributes or keep ur bean in
 session scope, it should work. Try printing the expression u gave in the
 rendered attribute and check.

 Sent from my iPhone

 On May 9, 2012, at 11:59 PM, Lim Hock-Chai lim.hock-c...@usamobility.com
 wrote:

  I tried both session and request scopes.  Both failed to work.  The
 thing is that the commandlink is showing on the page, which would mean that
 the rendered condition in the panelGroup or panelgrid is ok.  It just that
 when I click on the link that is inside the panelgroup/panelgrid, it does
 not work.  I even tried not using any rendered condition on the
 panelGroup/panelGrid, the link still not working.  Oddest thing.
 
 
 
  -Original Message-
  From: Shasi Mitra [mailto:shasimi...@yahoo.com]
  Sent: Wednesday, May 09, 2012 1:12 PM
  To: MyFaces Discussion
  Subject: Re: commandlink not working in panelgrid
 
  Are u sure ur bean is in session scope? Befor the action event is fired,
 it's verified whether the grid is rendered or not. So if the bean is in
 request scope, it returns False and therefore the link's action isn't fired.
 
  Sent from my iPhone
 
  On May 9, 2012, at 9:57 PM, Lim Hock-Chai lim.hock-c...@usamobility.com
 wrote:
 
  I'm currently using myfaces 1.1.9 for my web app.  I'm having some
 problems with commandlink not working correctly for me.  It appears that
 when commandlink is inside of the panelgrid, it is not calling the method
 specified in the action attr.  But it works fine if I put it outside of the
 panelgrid.  Strange part is that I've had other jsp that have commandlink
 inside datatable and they work fine also.  This is the first time I use it
 inside a panelgrid.
 
  See code below.  The first commandlink is, which is not inside of
 panelgrid, works fine.  The 2nd commandlink

RE: commandlink not working in panelgrid

2012-05-09 Thread Lim Hock-Chai
I should probably clarify by saying, it shows the link but just will not fire 
the action when click on it.  Another word, the rendered test is successful on 
panelgrid (hence the link is shown), but the test failed when clicked on the 
link.  Scratch my head on this for two days.  Learn a new tricks-of-the-trade, 
priceless...



-Original Message-
From: Lim Hock-Chai [mailto:lim.hock-c...@usamobility.com] 
Sent: Wednesday, May 09, 2012 3:36 PM
To: MyFaces Discussion
Subject: RE: commandlink not working in panelgrid

Finally got it to work inside panelgrid.  I don't understand it but it works.  
Shasi, I think you are right about the problem is caused by rendered attribute 
being evaluated as false when clicked.  Below is what I did to get it to work.  
Hopefully you or someone can explain why.

The code change that I made to get it to work is on this line only:
h:panelGrid  rendered=#{not empty sessionScope.MyAccountLoginType and 
sessionScope.MyAccountLoginType==resources.LOGIN_TYPE_MY_ACCOUNT }  

It works if I change it to this:
h:panelGrid  rendered=#{ sessionScope.MyAccountLoginType=='MA'}   
Note : value of MA is what I have in my message bundle 
resources.LOGIN_TYPE_MY_ACCOUNT.  Just to be sure, I did h:outputText 
value=#{resources.LOGIN_TYPE_MY_ACCOUNT} / and it output value of MA 
correctly.  Not sure why I can't use it to perform the rendered test.

I tried below and non of them work.  But I don't know why:
h:panelGrid  rendered=#{not empty sessionScope.MyAccountLoginType and 
sessionScope.MyAccountLoginType==resources.LOGIN_TYPE_MY_ACCOUNT }  

h:panelGrid  rendered=#{not empty sessionScope.MyAccountLoginType and 
sessionScope.MyAccountLoginType=='MA' } 

h:panelGrid  rendered=${not empty sessionScope.MyAccountLoginType and 
sessionScope.MyAccountLoginType=='MA' } 

 
-Original Message-
From: Lim Hock-Chai [mailto:lim.hock-c...@usamobility.com] 
Sent: Wednesday, May 09, 2012 1:52 PM
To: MyFaces Discussion
Subject: RE: commandlink not working in panelgrid

I added an onclick=alert(#{not empty sessionScope.MyAccountLoginType and 
sessionScope.MyAccountLoginType==resources.LOGIN_TYPE_MY_ACCOUNT }) on the 
commandlink element and the alert showing value of true when I click on the 
link.


h:panelGrid  
rendered=#{not empty 
sessionScope.MyAccountLoginType and

sessionScope.MyAccountLoginType==resources.LOGIN_TYPE_MY_ACCOUNT }
h:outputText value= /
h:outputText value=|/
h:commandLink  
immediate=true 
onclick=alert(#{not empty 
sessionScope.MyAccountLoginType and 
sessionScope.MyAccountLoginType==resources.LOGIN_TYPE_MY_ACCOUNT }) 
style=CURSOR: pointer  

action=#{commonTaskBean.fromMSAMBackToMyAccount}
h:outputText value=My Account/
/h:commandLink
h:outputText value=|/
/h:panelGrid

-Original Message-
From: Shasi Mitra [mailto:shasimi...@yahoo.com] 
Sent: Wednesday, May 09, 2012 1:36 PM
To: MyFaces Discussion
Subject: Re: commandlink not working in panelgrid

After u click the link also the expression in the rendered attribute is 
evaluated. That time it should be returning Faldo and hence ur action isn't 
being fired. If u remove all the rendered attributes or keep ur bean in session 
scope, it should work. Try printing the expression u gave in the rendered 
attribute and check. 

Sent from my iPhone

On May 9, 2012, at 11:59 PM, Lim Hock-Chai lim.hock-c...@usamobility.com 
wrote:

 I tried both session and request scopes.  Both failed to work.  The thing is 
 that the commandlink is showing on the page, which would mean that the 
 rendered condition in the panelGroup or panelgrid is ok.  It just that when I 
 click on the link that is inside the panelgroup/panelgrid, it does not work.  
 I even tried not using any rendered condition on the panelGroup/panelGrid, 
 the link still not working.  Oddest thing.
 
 
 
 -Original Message-
 From: Shasi Mitra [mailto:shasimi...@yahoo.com] 
 Sent: Wednesday, May 09, 2012 1:12 PM
 To: MyFaces Discussion
 Subject: Re: commandlink not working in panelgrid
 
 Are u sure ur bean is in session scope? Befor the action event is fired, it's 
 verified whether the grid is rendered or not. So if the bean is in request 
 scope, it returns False and therefore the link's action isn't fired. 
 
 Sent from my iPhone
 
 On May 9, 2012, at 9:57 PM, Lim Hock-Chai lim.hock-c...@usamobility.com 
 wrote:
 
 I'm currently using myfaces 1.1.9 for my web app.  I'm having some problems 
 with commandlink not working correctly for me.  It appears that when 
 commandlink is inside of the panelgrid, it is not calling the method 
 specified