This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JSP and the fly likes Populating fields on a webpage based on the remote webpage data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Populating fields on a webpage based on the remote webpage data" Watch "Populating fields on a webpage based on the remote webpage data" New topic
Author

Populating fields on a webpage based on the remote webpage data

dinesh lokesh
Greenhorn

Joined: Apr 27, 2009
Posts: 2
I dont really know where to post it,
but I have on Struts application runnung on a server say server 1
and a Other Java/ .net based application on other server- server 2

I am opening the server 1 from server 2 with the credentials and a search parameter in a URL, and displaying the data on server 1 page,
server 2 page is still open with a blank form in a browser window,

now after displaying the data on server 1 , I want to populate server 2 form with data in a selected row data in server 1..

THanks in advance.
Harmanjit Singh
Greenhorn

Joined: Apr 17, 2009
Posts: 4

One solution can be,
When row is selected on server 1 page, row data is copied to clipboard.

On server 2 page, have some button,which when clicked causing javascript to run that reads clipboard data, parse it and paste in into your form elements.

But be ready to get browser warning for potentially unsafe javascript code.

This would work for sure but don't know how users will react when they get browser warning for unsafe code. Also the code gets very complex for clipboard handling.


Other better way could be if parent / child relationship can be created between two pages and they can interact with each other directly. Some Javascript expert would be able to help you in this. (I will search for second solution. Lets see if I can find something.)


Harmanjit Singh
SCJP5 | SCWCD5 | SAP Certified Netweaver WADC
Harmanjit Singh
Greenhorn

Joined: Apr 17, 2009
Posts: 4
Second solution can be,

using "window.open(url)" and "opener" property avaialble to child window.
opener - Contains a reference to the window that opened the secondary window via window.open().

Using opener property you can call parent windows javascript method. So when you select a row in child window you can pass its content to parent window using opener.<methodname>(<content to pass>)

Tested with simple html pages
Parent.html

And "Child.html"
 
 
subject: Populating fields on a webpage based on the remote webpage data