JavaBeans and Js command

I’m new on dwr and i want to know if it is possible to add the js commands from the Java Code ?

I want to use dwr like xajax on PHP.
Please help me.

Thanks in advance

I’m not at all familiar with Xajax but if you describe the way you want to do things then I can hopefully tell you if you can use DWR in a similar way.

In the docs you can see how you invoke your Java code from Javascript:


I want to make the treatment in java and add js command directly in java code.

I took a quick look at an Xajax example at
and it shows that Xajax does not offer you to write your Javascript code as PHP code. Rather, it shows that the Xajax solution requires you to write your code as a mix of HTML, Javascript and PHP but allows you to mix all these in the same file (as is common for PHP).
So, make a distinction whether you are talking about a file or actual code in a certain language.

In DWR the normal usage is to separate the HTML and JS code from the Java code and keep these in separate files. I would estimate that the amount of HTML and Javascript code you need to write is about the same as for Xajax as you delegate much of the work to the Java code.

Before asking any more questions you should run through DWR’s demo examples by installing:
dwrdemo.war from
in a Java application server of your choice. The examples have documentation you can read as well and you will learn how DWR performs its functions.

If you actually want to mix all languages in the same file (which I do not recommend) then you should look at one of the Java templating languages, where JSP is the official one, but you can find a lot of other ones here: