[thelist] Java syntax....

Peter Barrett peterb at corel.com
Fri Apr 27 12:01:17 CDT 2001


Hi Anthony,

    Sorry for the late reply, I've been swamped.

    In Java, afaik the ternary operator is only valid as an RValue, as it has a return
value. So if you have something like

    a = ( x != null ) ? (getMyData()) : "";   // this is ok

    otherwise, use the well-worn 'if '

    if (x != null){
        getMyData()
    }

    and see if you get better results.

~pete

Anthony Baratta writes:

>
>  In order to ramp up more quickly with Java Server Pages, I'm using UltraDev
>  to create a few demo pages and run them with the JRun Server and IIS 5.0.
>
>  I have the JRun Server installed and working nicely. UltraDev is creating
>  code that is not being recognized by JRun. Here is an example:
>
>  <%=
>  ((rsReleaseSummaries.getObject("PRID")!=null)?rsReleaseSummaries.getObject("PRID"):"")
>  %>
>
>  This fails with a "java.sql.SQLException: No data found".
>
>  However if I shorten the line to only
>
>  <%=
>  rsReleaseSummaries.getObject("PRID"), I get data.
>  %>





More information about the thelist mailing list