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.
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,
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.
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.
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.
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?