Thursday, May 4th, 2006

DWR version 2.0 milestone 2: Write Javascript using Java

Category: Java, JavaScript, Library, Toolkit

Milestone 2 contains some great new features like Annotation based configuration and a customization to allow Reverse Ajax to use Jetty Continuations.

It also contains an experimental new feature to let you write Javascript using a Java API. Read on for how it works and why it can allow you to do some neat things.

Annotations: If you are using Java 5 then you can make use of the new DWR annotations thanks to Maik Schreiber. Combined with support for generic type reflection in milestone 1 (to get rid of the need for a <signature> element) you can use DWR without any need for dwr.xml. For more detail see the annotations documentation.

Jetty Continuations: The ongoing work with Reverse Ajax is to ensure that no webservers get hurt as a result of the extra load. The first piece of the puzzle is from Greg Wilkins of Jetty fame. If Reverse Ajax is turned on in a Jetty servlet engine then DWR will automatically use Jetty’s Ajax Continuations to save on server threads.

Write Javascript in Java: The New Java APIs create Javascript which is executed on the browser. We’ve started with DWRUtil and Scriptaculous Effects.

There are several reasons why you might want to do this:

  • DWR can use it’s Reverse Ajax feature to make your calls affect several browsers at the same time. This make writing Chat type apps quite easy.
  • My experience so far is that in many cases the Java code is easier to understand and shorter than the Javascript version.
  • Many people are put off DWR because it is Javascript heavy. This could help them out.
  • See the full release notes for more details on this and other features, with some examples of writing Javascript in Java.

    Please note that this API is very experimental so we’re not totally sure that we should implement it as we have done, or even if it is a good idea at all. I’m interested in your feedback.

    Posted by Dion Almaer at 11:12 am
    4 Comments

    ++++-
    4 rating from 35 votes

    4 Comments »

    Comments feed TrackBack URI

    Almaer ~
    I am facing problem in using the Collection object in DWR. I am using the Sping application context to intiate the service bean of DWR.
    Client side scripts throws syntax error, upon returing the collection of custom java object from server sider.

    Thanks
    prasad

    Comment by Prasad — May 9, 2006

    본광고는 전자상거래등에서의 소비자보호법에관한 법률 제13조 제1항의 규정에의한 광고 입니다…
    서울시 중구 초동 158-6 청수B/D4층 (代)02-2263-7528

    국제전화가장저렴하게 사용하는상품 들입니다.
    인터넷폰 사용자는 무료로 드립니다.(USB폰만적용)

    아래의 그림이 보이지 않을시에 자세한 내용은 홈페이지 내용을 참조하십시요…
    *홈페이지: jooanitn.com *한국상담(代)02-2263-7528*중국상담020-3660-3790

    허락없이 글을 올려 대단히 죄송합니다.게시판성격에 부적합하면 삭제시 패스워드12345입니다.
    등록을 거부하실때에는jooan1@korea.com으로 홈피의주소를 기입하셔서 거부의사를 보내주시면
    다음부터는 절대로 올리지 않겠습니다. 번거롭게 해 드려서 대단히 죄송합니다.

    Comment by 주안인터넷폰 — May 19, 2006

    http://ajaxian.com/archives/subject-dwr-version-20-milestone-2-write-javascript-using-java

    The page page above doesn’t display well on Firefox 2.0.0.3 on Windows XP. It’s shifted 3 inches to the right and there’s text that overlaps other text.

    — Doug

    Comment by Doug Hockin — May 10, 2007

    http://ajaxian.com/archives/subject-dwr-version-20-milestone-2-write-javascript-using-java

    The page page above doesn’t display well on Firefox 2.0.0.3 on Windows XP. It’s shifted 3 inches to the right and there’s text that overlaps other text.

    — Doug

    Comment by Doug Hockin — May 10, 2007

    Leave a comment

    You must be logged in to post a comment.