• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need to access Java methods and javascript functions in a WAR file from another WAR

 
Baranidharan Ramakoti
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having two WAR Files.

The first one contains a javascript and some utility Java methods along with the View Layer JSP.

Second one contains only the Web UI with some business logic for User Interface.

Both the WAR files are there in the same server.

I need to access the Java utility methods and javascript that is present in the first WAR from the second WAR file.

I cannot add the first WAR as a project reference in the second WAR and put it as a single WAR, as the requirement is strictly to deploy each WAR file separately

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 and Java methods in the first WAR File?


Thanks,
Barani
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Doesn't look anything specific to JBoss. Servlets forum perhaps is a better place, but i don't understand what you mean by "need to access". What kind of access? You have want to refer to the java classes packaged in a different war file? If yes, then why not package those classes in a jar and then include them in both WAR1 and WAR2?

I'll let this thread stay here for sometime, because i am not sure where this one fits best.
 
Peter Johnson
author
Bartender
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Baranidharan Ramakoti wrote:I need to access the Java utility methods and javascript that is present in the first WAR from the second WAR file

This is not possible - code external to a WAR file cannot view anything within that WAR file (in your case, the first WAR cannot use anything that is in the second WAR).

You will have to do as Jaikiran suggests:
Jaikiran wrote: package those classes in a jar and then include them in both WAR1 and WAR2

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic