• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Simple Query

 
Ranch Hand
Posts: 1400
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Varun Khanna
Ranch Hand
Posts: 1400
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 3244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1400
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 :-)
 
author
Posts: 621
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1400
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 would challenge you to a battle of wits, but I see you are unarmed - shakespear. Unarmed tiny ad:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic