Question ID :997046238320 Which of the following are correct JSP expressions? why "<%=System.out.println(new Date())%>" is not correct answer.It will be "out.println(System.out.println(new Date()))". Am I right?
Originally posted by ruijin yang: Hello Win, For expression in JSP page,it need an String object.Here, System.out.println(new Date()) itself is not a String.So it produces error.If I am wrong,please correct me. ruijin yang
I think it will call "(new Date()).toSting()" method implicitly. Maybe the problem is out.println(Nov.23th 2:0pm) if "(new Date()).toSting()" =Nov.23th 2:0pm. Just guess.
Originally posted by Tim Duncan: I think you misunderstood. The problem is that the return value from the System.out call is not a String (it outputs a string on System.out, but that's not the same thing).
OK I tried it. I got error:" Incompatible type for method. Can't convert void to java.lang.Object." The best way to understand is to try it. Thanks Duncan.
[This message has been edited by Win Yu (edited November 21, 2001).]