Two Laptop Bag*
The moose likes JSP and the fly likes Simple Query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Simple Query" Watch "Simple Query" New topic
Author

Simple Query

Varun Khanna
Ranch Hand

Joined: May 30, 2002
Posts: 1400
Hi,
I have an jsp from which I am using the code to launch a pop-up.
I need to pass my request,response and session object to the pop-up window "test2.jsp".
Though passing through the query string working fine but since the data is too large i need a help in that.
I m opening the pop-up using onclick window.open() method.
Thanks in advance
Varun
Shubhrajit Chatterjee
Ranch Hand

Joined: Aug 23, 2001
Posts: 356
1. Session object is available to all JSPs in a session.
2. JSP pages will have their own request/response object. I think u mean to access the request and response of the parent. This is not possible Directly ... but you can definitely save these in session using some key. But this is a weird requirement ... I have never heard of anything like this before ... if you can tell us what you want to do, folks here might suggest some better ways to do it.


Shubhrajit
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
varun
Since you're using javascript to open the new window the HTML page has already been rendered and the Request and Response are no longer valid objects. For the most part those can only be manipulated server side not client side. Your best bet in this vcase would be to assign some javascript variables the values you need them to have (or use hidden form fields) and then you can manipulate them with the popup window.


Dave
Varun Khanna
Ranch Hand

Joined: May 30, 2002
Posts: 1400
Thanks Shubhrajit/ Dave,
I know its weird but sometime u need to go with ur client's requirement.
My parent jsp page consistes of rows which r being retrieved using jsp:usebean with request as well as session scope.Now to alter anything in those row a search is needed.The client has implemented that search in its own way using pearl language though at our end calling that url(which is exposed to us) simply displays a enterprise search window.Now in between these two client wants a simple pop up with simple one text box to show what has been selected from the enterprise window and want to save changes through that pop-up only i.e. like submiting the parent form through pop-up.What i need to carry in pop-up is information regarding ~ALL THE ROWS~ of parent form which need to be modified with those *SEARCHED* values.So that i can submit from pop-up only.
Using session is okey but sometimes the no. of selected rows can be on a higher side so putting all that in session doesn't makes good point.
So that sums-up the scenario.
I hope i was able to make my point.
Thanks in advance again
Varun
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
Varun
You lost me with the explanation. You have three pages:
The first is a bunch of rows that the user can search and change?
The second is a search form that the user enters a query into and searches the rows from the first page?
The third page is a popup that shows the results of the search?
Let me know if I'm way off base...
Anyway, once the HTML page is displayed to the user in their browser everything else that happens must happen client side unless you make another round trip to the server. To open a popup window as you described you are using javascript. In javascript that only way to pass information between windows is to use either variables in the javascript or hidden form fields on the pages themselves.
You can either pass all of the data to the new window and populate a form that is show there that fiorm is then submitted to the server to update the database or you can have the popup window change a flag in the parent window (the 'opener' in javascript) that the server examines to see if that row gets updated or not.
Using the request or respone is not an option because you are not doing any of it server side - unless I realy misunderstood your description. If your problem is storing things server side between trips to the client then you are only able to use the session or the servletContext, unless you are going to create your own flat file sor DB entry to do it.
hope that helps a little bit, if not please explain your situation better for me, I'm a little slow sometimes
Varun Khanna
Ranch Hand

Joined: May 30, 2002
Posts: 1400
Thanks Dave,
To put in simpler words.
My architecture consists of single servlet, which caters each request and further directs them to different java Business object classes which further submits to DB.Now the servlet performs various checks on request object header and on cookies and creates certain object( based upon the request object).
To put it simpler what we discussed, on the parent jsp page end-user selects(thru chkbox) some rows and for all of them selects one *VALUE*
from pop-up and from that pop-up only a submission is needed so that the pop up gets close after the submit and the parent window refreshes with the page now showing the modified changes.
Though I have everything on pop-up to submit but I want to avoid hardcoding for header values of request, which are in request since logging.
So I thus need to have request object in pop-up....
thats the situation....
hope i m able to make my pt. clear this time :-)
Sean MacLean
author
Ranch Hand

Joined: Nov 07, 2000
Posts: 621
I not sure why you're doing it the way you are doing this but I don't think you'll be able to get the request object in a pop-up window. I have tried to do this to gain access to beans in request scope within a pop-up off the main window and it just isn't possible (because the window is opened, not but the browser responding to a request, but by javascript). Can you not simply do it all in one page and then have the processing servlet send back an updated page?
Sean
Varun Khanna
Ranch Hand

Joined: May 30, 2002
Posts: 1400
Thanks Sean,
As I said thats the client requirement.Its worked out now.:-)
During submit now i m submitting the values back to the parent window (from pop-up) and hence submitting the parent form only and thus retainnig the request,response object also.
Thanks a lot for the advises.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Simple Query