tags:

views:

112

answers:

2

I wanted to use DWR from web application A, but the DWR servlet is in web application B.

Is this possible? Is there any work-around?

Thanks!

A: 

You can fetch static content from a dwr servlet in another web app, via requests on the client side.

However, you won't have access to services/business objects/session/request/state from one application to another - without custom modifications.

Mercer Traieste
A: 

Yes, totally you can do that.

When you include the generated javascript file to be used in application A, you need to specify the B application path (where the dwr servlet is deployed) as follows:

<script type='text/javascript' src='[application B path]/dwr/interface/[javascript class name].js'></script>

[application B path] would be something like http://my-domain.com

[javascript class name] would be as delcared in dwr.xml on application B

<create creator="new" javascript="[javascript class name]">
    <param name="class" value="com.my-domain.Class"/>
</create>

and you can use any core javascript classes as follows:

<script type='text/javascript' src='[application B path]/dwr/engine.js'></script>
<script type='text/javascript' src='[application B path]/dwr/util.js'></script>
Ahmad