akshay
akshay

Reputation: 115

How to access one web application from another web application (jsp)

I have two web applications in jsp:

now I want to call the jsp of 2nd web application from 1st web application and also want to pass some data during run-time.

So how can I achieve that, please suggest me some solution.

Upvotes: 2

Views: 3312

Answers (2)

ashokramcse
ashokramcse

Reputation: 2861

It was very simple both will be running on some URL alone so redirect that to other. The major thing you should concentrate on the passing data should accomplish a same data store i.e., both should point a same database or any other data storing technique. You have to design a database such that both should use the same data without any conflict.

enter image description here

If you want to use without any central repo you can pass the data by building it on an XML,JSON or any other technique that can act as a data carrier between two applications.

Upvotes: 3

Aaron Digulla
Aaron Digulla

Reputation: 328754

You can't directly access JSPs on a different server for various reasons (security among one of them).

What you can do:

  1. Use an iframe to display a remote URL inline
  2. Use a HTTP client library on one server to access the second server via HTTP
  3. Add a JSON servlet to the second server which gives you access to the data you need. This allows you to use JSONP to access the data directly from the client or to process it with a JSON framework on the first server.

Upvotes: 2

Related Questions