• 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

Refresh parent window without closing popup with struts validation

 
Ranch Hand
Posts: 84
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am using struts 1.2.

Main page is having 'Add' button which can open add popup window. In popup window there are so many fields which are validated by struts validator framework by click 'Update' button. Once validation success, the corresponding popup window action(UpdateAction.java) has to be executed and parent window should be refreshed without closing popup window.

The above is the requirement. How can i achieve? please help.
 
Ranch Hand
Posts: 329
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mani,
There is nothing to do with struts for this. Do the action call as usual. Submit your pop up request and on body load use
 
Rajagopal Mani
Ranch Hand
Posts: 84
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Thanks for the reply. If action call as usual, the forward jsp also should be mapped as well. Assume the forwarded jsp is like below,

Dummy.jsp


struts-config.xml


If popup is not closed explicitly, the forwarded jsp(empty page) is displayed in popup screen. However, the parent screen is reloaded. If popup is closed, this problem is ignored. But as per the requirement, the popup screen should keep display. Is there any way to have only action class to be executed without any forwarded jsp mapping in struts MVC architecture? please suggest if there is any better solution and point out if am doing any mistake.
 
Shankar Tanikella
Ranch Hand
Posts: 329
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well, my understanding of your problem is as below.
You have say, parent.jsp, popup.jsp
Upon accessing "Add" button in your parent.jsp it opens popup.jsp (action 1)
Now on performing some selection in popup.jsp you submit the form (action 2) to add it in the parent jsp.

To solve your problem,
After performing "action 2" in your action class forward control back to "action 1" using struts (what it does is, it would refresh your popup, you would not get the blank screen). While doing so, just put up some param to identify that this is coming after performing "action 2".
Now when the popup reloads check for this param and refresh the parent window as mentioned earlier. Thats it!

In the above code you are forwarding it to dummy (which is not the actual popup.jsp) jsp which is not necessary and leading you to blank screen.

Additionally, If you do not want your pop up to be refreshed, just use asyn call (AJAX) to do it for you.

 
Rajagopal Mani
Ranch Hand
Posts: 84
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,


After performing "action 2" in your action class forward control back to "action 1" using struts



The above scenario could be acheived without forwarding to "action 1" with input attribute and without forward tag as like below.



In action 2,


But as mentioned, the popup jsp will be refreshed. I believed like there may be better solution(without refresh popup) in this case regard. However i will try to use AJAX as you mentioned. But i would like to confirm that usage of AJAX tech to struts application will overload/overhead the application? Please clarify if am not correct.
 
Shankar Tanikella
Ranch Hand
Posts: 329
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, in general AJAX is not the only option though, but for your scenario wherein usage of server push technology is not permitted (I suppose) using simple Struts 1.x application and to suffice your business requirement we have to compromise on something (as always). But I don't see any such major problem in your case. What would be the maximum (rough) user base for your web application concurrently?
I would say it is not at all a problem since, you would not be transporting much data across to cause any overhead, it would be just a param, right?
 
Rajagopal Mani
Ranch Hand
Posts: 84
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply & suggestion. I will investigate further and try to modify the design.
 
Would you turn that thing down? I'm controlling a mind here! Look ... look at the tiny ad ...
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic