Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Servlets and the fly likes .war to .war communication Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark ".war to .war communication" Watch ".war to .war communication" New topic
Author

.war to .war communication

sita raman subra
Ranch Hand

Joined: Apr 09, 2007
Posts: 47
Hi,

Anybody explain me about how to sahre the session data between two war.
Also how to call the jasp in one war from other.

Thanks & Regards,
Sitaraman
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

A war file is just a packaged web app.

The servlet spec doesn't go into a lot of detail on the subject of cross context communication so you can expect inconsistent behavior across containers at best. For this reason, you will need to consult the documentation for the container you're using.

I don't understand this next question.
Also how to call the jasp in one war from other.

Maybe you can re-phrase it or go into a little more detail?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3350

Originally posted by Ben Souther:
..

I don't understand this next question.

Maybe you can re-phrase it or go into a little more detail?


I guess he was intended to ask 'how to call a jsp in one war file from another'! Is it not?


Everything has got its own deadline including one's EGO!
[CodeBarn] [Java Concepts-easily] [Corey's articles] [SCJP-SUN] [Servlet Examples] [Java Beginners FAQ] [Sun-Java Tutorials] [Java Coding Guidelines]
sita raman subra
Ranch Hand

Joined: Apr 09, 2007
Posts: 47
Yes its JSP not JASP.sorry.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61449
    
  67

There isn't such thing as "calling" a JSP. You'll need to be more explicitly regarding what you want to do. Are you just trying to create a link to the foreign JSP?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
sita raman subra
Ranch Hand

Joined: Apr 09, 2007
Posts: 47
ie how to rediredt from the jsp in one war to jsp in other war.But i got it now.I think we can go for sendredirect.

But please advice whetehr their is any way to share th data between the war files.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Again, the war file isn't the application.
It's the packaging.
The term you're looking for is 'context' which is synonymous with 'application' or 'web application'; often just called 'webapp' or 'app' for short.


Yes, you can use sendRedirect to redirect to a JSP in another context.
Because sendRedirect uses the browser to generate a new request, you can use it to redirect to any page, even pages outside your context, server, or domain.

The spec also makes it possible to forward to a resource in another context but security conscious containers don't allow this by default.
sita raman subra
Ranch Hand

Joined: Apr 09, 2007
Posts: 47
But in my project A suppose to pass data from my application to other running in the same server
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42364
    
  64
You'll need to be more specific about what "pass data from my application to other" means - From java class to Java class? Through parameters in a link? An HTML form?

In general, there are any number of ways for two web apps to exchange data: through files, database, email, messaging, web service, RMI, HTTP, sockets, ... What's appropriate really depends on the circumstances, about which you haven't said anything.


Ping & DNS - my free Android networking tools app
 
jQuery in Action, 2nd edition
 
subject: .war to .war communication