wood burning stoves 2.0*
The moose likes Servlets and the fly likes passing request parameter/attributes in IFRAME Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "passing request parameter/attributes in IFRAME" Watch "passing request parameter/attributes in IFRAME" New topic

passing request parameter/attributes in IFRAME

Neeraj Vij
Ranch Hand

Joined: Nov 25, 2003
Posts: 315

Please consider the following scenario and provide your inputs -

1.) I have a website for example http://www.parent.com and I open it in FireFox 3.5.

2.) I need to open different website servlet http://www.child.com/queryservlet, inside an IFRAME tag in http://www.parent.com/query.jsp page

3.) I need to pass some request/session parameter/attribute{for example name=test} to http://www.child.com/queryservlet

4.) based on parameter passed in step 3, http://www.child.com/queryservlet needs to return back the control to http://www.parent.com/query.jsp along with the result of the processing based on the parameter passed in step 3{for example - result=pass}

I am not sure if a session is same inside different application opened inside an IFRAME tag.

Kindly suggest the best possible option- whether to use session or request scope variables

Also, suggest is it safe to communicate between 2 different applications like the above mentioned way?

Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183

I think you are talking about two different web applications on two totally different machines. In that case the only way to pass arguments is passing them in the query string (as if you opened the website yourself in the browser), or generating a POST request.

Your example however (since you want some information back from the other site) pretty much sounds like a candidate for a webservice.

JDBCSupport - An easy to use, light-weight JDBC framework -
Neeraj Vij
Ranch Hand

Joined: Nov 25, 2003
Posts: 315
yes. both are differnet applications hosted on different machnies.

Neeraj Vij
Ranch Hand

Joined: Nov 25, 2003
Posts: 315
I am able to implement the above scenario in using request parameters.

For testing purpose I am trying to use Paros Proxy server to intercept request and change the parameters at runtime. But the iframe containing the Application B does not open up, when I send my request using Paros as proxy server.

If I use normal internet connection settings, both application communicate between themselves very well.

Any inputs will be a great help in this matter.

It is sorta covered in the JavaRanch Style Guide.
subject: passing request parameter/attributes in IFRAME
Similar Threads
Passed SCBCD 5, sharing experience
netui tag
Passed OCMJEA !!
Passed Part One with 87%
Passed SCEA with 98%