• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Opening Pop up WIndow from action class

 
Ranch Hand
Posts: 279
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I want to know if there is anyway I can open a pop up window (a jsp) using action class.

The flow will like this. I have the message to appear in the jsp pop up page in the action class. I need to print the message in the pop up window. Is it possible from action class, or should I pass the string to my servlet. Is it possible to open pop up window from servlet? Please let me know if this is possible or not.


Actually my requirement is as follows.

I have a login.jsp. After I enter the details I get an arraylist from the servlet and display in the customer.jsp. The customer has options to enter more details. After he enters he has an option to save it. He can use a button to save the new entered details.
The customer also has an option to generate the old and new details in String form, i.e it will be having all the new values and old values arranged in order. Hence this is dynamic and has to be obtained from databse. He can click on a button to open a pop up window(generate.jsp) which gets all the new and old details from the database and displays in the pop up jsp(generate.jsp). But the main window should be customer.jsp at the background.

I am able to get the details in the same page itself, but giving the details in the pop up window with the main window at the back, I couldnt do it. Any suggestions are welcome. I am just using

in my main page(customer.jsp) to open the new window.

Thanks
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The window.open() function is Javascript and gets called on the client (browser). When it opens, the browser makes a new request. What goes in it will be rhe results of that new request.
 
vjy chin
Ranch Hand
Posts: 279
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ben,
thanks for the reply. Actually I found a solution which will work for me, though I couldnt find a way to open a pop up from a servlet.

The response from the servlet comes to the jsp page and in the jsp page I am using onLoad method in the body tag. The onLoad method checks for a particular string. If the string is equal to the value I am checking, the pop up window opens.

If anyone wants still mroe details, I would be happy to provide.

Thanks
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by vjy chin:
Ben,
I couldnt find a way to open a pop up from a servlet.


Servlets live on the server. You can't open a popup from the server.
What you are doing is perfect.
You are opening the popup from the client, with client-side code, Javascript.
 
vjy chin
Ranch Hand
Posts: 279
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks dude. Its good that its working. Thats the ultimate thing.

Thanks once again for the help
 
Greenhorn
Posts: 5
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In your customer.jsp, call something like browse details(java script call)

<script language="javascript" type="text/javascript">

function callBrowseHierarchy(){
window.open("<%=contextpath%>/action.do","Browse","left=600,top=450,width=350,height=160,toolbar=0,resizable=0");
}

This will make a call to action class. Action class will thorow your generate.jsp as pop up window.

Thanks
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

vjy chin wrote:Ben,
thanks for the reply. Actually I found a solution which will work for me, though I couldnt find a way to open a pop up from a servlet.

The response from the servlet comes to the jsp page and in the jsp page I am using onLoad method in the body tag. The onLoad method checks for a particular string. If the string is equal to the value I am checking, the pop up window opens.

If anyone wants still mroe details, I would be happy to provide.

Thanks



Hi ben,
I have a same requirement as yours but slightly different. I have to get to the popup and back to same action class to fulfill the steps.

So its like:
1. Display the jsp.
2. On submit go to processAction.
3. fetch required details.
4. forward to a popup.
5. get data from popup.
6. update the db from processAction.

So I have to make two transits from the UI to server and back twice.

Any Idea how I can perform that?

Thanks in advance.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As already stated, this cannot be handled from the server or the servlet. Popups are controlled on the client with JavaScript.
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Srinivas Reddy Patelu wrote:In your customer.jsp, call something like browse details(java script call)

<script language="javascript" type="text/javascript">

function callBrowseHierarchy(){
window.open("<%=contextpath%>/action.do","Browse","left=600,top=450,width=350,height=160,toolbar=0,resizable=0");
}

This will make a call to action class. Action class will thorow your generate.jsp as pop up window.

Thanks




Srinivas can i know what will be the contextpath?
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The context path is the prefix that identifies the web app on the server. Be sure to use the EL, not scriptlets.
 
Krish Khan
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks!


I got it.
 
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Srinivas Patelu , thanks .
 
reply
    Bookmark Topic Watch Topic
  • New Topic