The Artima Developer Community
Sponsored Link

Java Answers Forum
do classes have properties

1 reply on 1 page. Most recent reply: Jun 14, 2002 10:09 PM by Matt Gerrans

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
geoff

Posts: 3
Nickname: cakewalkr7
Registered: Jun, 2002

do classes have properties Posted: Jun 14, 2002 1:52 PM
Reply to this message Reply
Advertisement
I've tried to create a method in my applet that will return the current system time ....

public Long getUsersSystemTime()
{
Long l = new Long( new java.util.Date().getTime() );
return l;
}

... but when my javascript calls it, it gets an object doesn't support this method or property error. I've combed through my java and html code and I can't find any reason why it wouldn't work. So, my only other option I can think of is to have a property in my applet that my javascript can read. I know in C# you can do a get set property block. Is there anything like that in Java that I could do? Thanks.


Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: do classes have properties Posted: Jun 14, 2002 10:09 PM
Reply to this message Reply
I don't understand exactly what you mean by having your javascript call your java code. The JSP or Servlet that is writing the page could just put the time somewhere. If you want it more dynamic, javascript can get the time itself by instantiating a Date object, like so:
   var currentTime = new Date();
   document.write( "The current time is " + currentTime );


If you want it to be kept up to date, you could keep updating a form element. Maybe I don't understand what you are trying to do...

Flat View: This topic has 1 reply on 1 page
Topic: exe file Previous Topic   Next Topic Topic: Passing Parameters in JSP

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use