This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have David & Dawn Griffiths on-line!
See this thread for details.
Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Question ID :997046238320

 
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Win Yu
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Win Yu:
I think it will call "(new Date()).toSting()" method implicitly.


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).
 
Win Yu
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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).]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic