Forums Register Login

Need to refer a Javascript from another WAR file

+Pie Number of slices to send: Send
I am having two WAR Files. The first one contains a javascript and some utility functions along with the View Layer JSP. Second one contains user interfaces. Both the WAR files are there in the same server.

I need to access the utility functions and javascript from the second WAR. I am not sure, how to do this.

I cannot add the first WAR as a project reference in the second WAR and put it as a single WAR, as these two needs to be separately deployed.

Can I use context path and access the Java Utility functions? is it possible to use the same method for getting the Javascript functions?

Can anyone suggest any method to access the Javascript functions?

I am not sure, whether this question is relevant in this thread. I have posted it here, as i am using a JSP and servlet.

Thanks,
Baranidharan
+Pie Number of slices to send: Send
A web app can't access Java code in another web app.

JavaScript files generally reside in public directories, so it's possible to reference them using an "http://..." URL. I wouldn't recommend that, though. It's too easy to create problems later if you want to restructure the files/directories of the web app. Why not include the JavaScript files in both web apps? If you want only a single copy of the file, you can structure your source code repository in a way that both web apps get the file from a single location in it.
+Pie Number of slices to send: Send
Thanks Ulf for your instant reply.
+Pie Number of slices to send: Send
What is the use of communicating between two WARs? I have seen one of the Threads regarding this in Javaranch and had found that communication can be done in many ways.

If the utility Java functions inside WAR and other files cannot be accessed, then what is the reason for setting dependencies between two WARs?

Can someone just throw some light on these questions?

Thanks,
Baranidharan Ramakoti
It is no measure of health to be well adjusted to a profoundly sick society. -Krishnamurti Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 2517 times.
Similar Threads
accessing request scope variable from javascript
Need to access Java methods and javascript functions in a WAR file from another WAR
download extension mechanism not working for WAR file in WebLogic 7.0
EJB in WAR Accessible from Components in Other Modules?
Apache Rhino questions
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 01:56:49.