struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Slattery, Tim - BLS" <Slattery....@bls.gov>
Subject RE: [java:Conditional Operators]
Date Thu, 30 Mar 2006 20:52:09 GMT
> I did not understand the following code with multiple 
> conditional operators.
>           boolean vIsForm=true;
>           String vForwardName = 
> (aActionMapping.findForward(vWorkForwardName) == null)
>               ? (vIsForm) ? "form" : "task"
>               : vWorkForwardName;
>   
>   Can some body explain me how to read the above code?
>   Thanks & Regards

Nasty, nasty. Very terse, but nearly unreadable. Better to untangle it
somewhat and make the code more understantable. I believe it works out
like this:


If (aActionMapping.findForward(vWorkForwardName) == null)
{
   if (vIsForm)
   {
      vForwardName = "form";
    }
   else
   {
        vForwardName = "task";
   }
}
else
{
     vForwardName = vWorkForwardName;
}


-
Tim Slattery
Slattery_T@bls.gov


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message