This discussion is archived
1 Reply Latest reply: Feb 8, 2013 4:05 AM by Frank Nimphius RSS

how to avoid null value when pass parameter in pagedef

grodno Newbie
Currently Being Moderated
hi,

a little elegant advise needed!
in pagedef i hava a function with input parameters
in case pageFlowScope.dcaid is not populated i get an error upon function invocation


<methodAction id="setDcaAssignmentBatch" RequiresUpdateModel="true" Action="invokeMethod"
MethodName="setDcaAssignmentBatch" IsViewObjectMethod="false" DataControl="AppModuleDataControl"
InstanceName="data.AppModuleDataControl.dataProvider">
<NamedData NDName="pDcaid" NDValue="#{pageFlowScope.dcaid}" NDType="oracle.jbo.domain.Number"/>
</methodAction>

how can i make sure the value is set some default value , say 0
i assume it would be something like
NDValue="#{(pageFlowScope.dcaid==null?0:pageFlowScope.dcaid)}" - this one doesn't work , though...
please share!
  • 1. Re: how to avoid null value when pass parameter in pagedef
    Frank Nimphius Employee ACE
    Currently Being Moderated
    Hi,

    instead of referencing a pageFlowScope attribute directly, create a managed bean in page flow scope
    public class MyBean{
    
    oracle.jbo.domain.Number dcaid = new oracle.jbo.domain.Number(0);
    
    public void setDcaid (oracle.jbo.domain.Number in){
       
       dcaid = in;
    
    }
    
    public oracle.jbo.domain.Number getDcaid(){
       return dcaid;
    
    }
    if you reference this in your PageDef file then the value will never be NULL
    }

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points