Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Modal Dialog Problem

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am using struts in my application. I am facing some problem for showing some results in different window.

I am setting some attributes in session and openning a screen through showModalDialog.

My code is :window.showModalDialog("/Booking.do?btnType=abc",arr,'dialogWidth:662px;, dialogHeight:180px; help:no;scroll:no; status:no; center:yes; resizable:no; unadorned:yes;');

Its opens the appropriate screen with some .jsp extension.

But problem is that when i submit one action through this screen it opens another same .jsp page with new values what i have entered.


I want the result will be viewed in same window ,not in different window.

How do i specify a target and where i have to use it.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The showModalDialog was never intended to start another conversation with the server. It was intended to elicit a single respone and then immediately return to the main page. If you're planning on keeping the window open for multiple submits, I'd suggest using window.open() instead. If you submit a Struts action in a form opened with window.open(), the server will return the response to the same window with no problems.
[ May 23, 2006: Message edited by: Merrill Higginson ]
 
anirudh das
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But window.open() creates a new session. I want the same session in which i have already so many data with session.setAttribute().

I have tried with popup window in Struts.But it also creates a new session.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use window.open() all the time and it does not create a new session for me. I'm able to access the original session and modify it.

I'm wondering what the factors might be that are causing a new session to be created for you. Could you show us the basic code that you're using to open a window and populate it with a JSP? Maybe something will pop out at me.

Also tell us a bit about your environment, specifically which App Server, which browser, and which version of Struts you're using.
[ May 24, 2006: Message edited by: Merrill Higginson ]
 
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any submit that was done from a modal window automatically launch a new window.

A workaround is to have the modalWindow open a frameset with a hidden frame. Then have you form in the modal window target its own frame on submittal and a new window will not open.

openModalDialog is IE only and also can occassionally lose cookies when the window is opened.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This iframe solution works fine to submit form in modal dialog window but I have another issue. If any can help, i'll appreciate.

I am submitting form from modal dialog window to export data in different file formats like excel, word, html etc.

It works fine for excel and word formats but not for html. When I select html format and submit form, correct response comes and browser opens one dialog box for user to ask "save", "open" and "cancel" export data. It works fine if user save the file as html but not able to open file as html.

I think this is because its a modal window not the normal browser window.

Can you please help me with this and if somebody knows some solution, please reply back.

Thanks
Deepika
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Deepika,

Did you get the solution for your problem. If yes, please share it over here.

 
    Bookmark Topic Watch Topic
  • New Topic