>All Tutorials 
Ajax and .NET Ajax and .NET RSS XML
Ajax and ColdFusion Ajax and ColdFusion RSS XML
Ajax and Java Ajax and Java RSS XML
Ajax and PHP Ajax and PHP RSS XML
Ajax and SOA Ajax and SOA RSS XML
Ajax Goodies Ajax Goodies RSS XML
Ajax Tool Ajax Tool RSS XML
Facebook MockAjax Facebook MockAjax RSS XML
Google Web Toolkit Google Web Toolkit RSS XML
JavaScript Framework JavaScript Framework RSS XML
Ruby on Rails Ruby on Rails RSS XML
Technique Introduction Technique Introduction RSS XML
Without XMLHttpRequest Without XMLHttpRequest RSS XML
Yahoo! UI Yahoo! UI RSS XML

Call a Built-in Java Object from JavaScript Using DWR - java date object javascript time dwr web page

 
Registered tutorials: 501
Registered Users: 33128



Rating: 5 out of 1 votes cast


  
Category: Ajax and Java

Call a Built-in Java Object from JavaScript Using DWR

Digg this   Post to del.icio.us

Abstract: The code in this tutorial displays the current date and time, and compares this data to the Greenwich mean time (GMT) date and time. This XML file binds the JavaScript name JsDate to a corresponding Java Date object

Extend your code’s reach by calling built-in Java objects remotely.

 

What if you had to read a file like a log on a server from a JavaScript object on the client browser? You might want to use the java.io.FileReader class on the server. (This class is part of the Java 2 Standard Editiona fancy way of saying that FileReader is built into Java but not JavaScript.) The DWR framework allows you to easily call standard Java methods from your JavaScript. This hack displays some date information on a web page. The data derives from remote method calls using the java.util.Date object.

JavaScript has a robust Date object and several associated methods, which you would use in most real-world applications that display dates on a web page. It’s still nice to know, from at least a hack writer’s perspective, that a great variety of standard Java objects and their methods are available from JavaScript. At the very least, you can adapt these techniques to several other similar situations.

 

The code in this hack displays the current date and time, and compares this data to the Greenwich mean time (GMT) date and time.

Setting up this code involves a little server configuration, as this chapter’s first hack explained. (If you’re still setting up DWR on the server, check back to “Integrate DWR into Your Java Web Application” for a summary of the required steps.) Here is the configuration file to place on the server:

<dwr>
    <allow>
        <create creator="new" javascript="JsDate">

            <param name="class" value="java.util.Date"/>
        </create>
    </allow>
</dwr>


Read Full Tutorial...



Reviews:

Rate and Review This Site

No reviews yet


Statistic Information About this Resource:


Total Hits: 178
Unique Hits: 148


  Daily Weekly Monthly
  Unique Total Unique Total Unique Total
Average 0.3 0.3 0.6 0.6 2.6 3
Current 0 0 0 0 0 0
Previous 0 0 3 3 5 5
Nov 29 0 0 0 0 5 7
Nov 28 0 0 0 0 1 1
Nov 27 1 1 2 2 0 0
Nov 26 1 1 0 0 2 2
Nov 25 1 1 0 0 3 3
Nov 24 0 0 0 0 0 0
Nov 23 0 0 1 1 2 2
Nov 22 0 0 0 0 8 10
Highest 4 6 9 10 23 31


Script Execution Time: 0.96653 | SQL Queries: 10 | Members: 501
Ajax Tutorial Top List - Powered by Aardvark Topsites PHP 5.1.2