This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Oct 29, 2012, 12:47 PM
11 Posts

beforeRenderResponse and EL

  • Category: Managed Beans in NSF
  • Platform: Windows
  • Release: 8.5.3
  • Role: Developer
  • Tags: beforeRenderResponse EL Expression Lanaguage
  • Replies: 2
Hi
 
I have a managed bean for a document which has file attachments. I need to validate the file attachments in beforePageLoad and check for new uploads in beforeRenderResponse.
I can use EL to call the bean method in beforePageLoad but NOT for the beforeRenderResponse - the server console reports
"HTTP JVM java.lang.Illegal Argument Exception: wrong number of arguments". Through system.out statements I know that the beforePageLoad is called and that the error is related to the beforeRenderResponse parameter
 
If I change the beforeRenderResponse from EL to SSJS it works fine.
It this an issue with my code, or is not possible to use EL for beforeRenderResponse ?
 
non-working code
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xc="http://www.ibm.com/xsp/custom"
    beforePageLoad="#{bCase.validateAttachments}" beforeRenderResponse="#{bCase.updateAttachments}">
 
working code
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xc="http://www.ibm.com/xsp/custom"
    beforePageLoad="#{bCase.validateAttachments}" beforeRenderResponse="#{javascript:bCase.updateAttachments()}">

Oct 31, 2012, 7:33 AM
14 Posts
Re: beforeRenderResponse and EL
Andrew,
 
We you use managed beans and EL, there is an "automatic" translation to getter and setter, which means when you use the EL :
 
#{bCase.updateAttachments} 
 
the method called when you read data (i.e. getter) the method called is the method getUpdateAttachments of the bean bCase. When you use the bean to set data, the method called will be setUpdateAttachments.
 
So from what you show in your code, I suppose your method in the bean is called "updateAttachments". If it's the case, try to change the name of the method in the bean to "getUpdateAttachments" and your EL should work.
 
But then if you use SSJS, you will have to change your code to bCase.getUpdateAttachments()
 
Hope this helps

Renaud 
Oct 31, 2012, 7:54 AM
11 Posts
Re: beforeRenderResponse and EL
Thanks for the reply Renaud
 
I understand the translation of the EL name to the bean method name, however this is only necessary when getting and setting properties.
If calling an server side action  from an event handler you can use the exact method name. The beforePageLoad parameter also takes an untranslated method name.
 
e.g. 
    beforePageLoad="#{bCase.validateAttachments}" 
calls
    public void validateAttachments() {

        ....code...
    } 
 
 
Still, in case that was the issue I added an additional method to the bean - however I still get the illegal argument exception
 
    public void getUpdateAttachments() {
        updateAttachments();
    }
 
    public void updateAttachments() {
        ....code...
    }
 
 I can work around this by using the javascript call, but I want to improve my understanding of why this isn't working as expected
 

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal