aspose file tools*
The moose likes Struts and the fly likes Popup window using Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Popup window using Struts" Watch "Popup window using Struts" New topic
Author

Popup window using Struts

Jyothi Venkatrao
Greenhorn

Joined: Aug 20, 2010
Posts: 4
I have a struts application. One of the JSP pages in that application (Say A.jsp) pops up another JSP page(C.jsp) using a javascript window.open() function. The same ActionForm and the Action class are associated with both these pages. But in the popup JSP page(C.jsp), I see that all the form attributes are getting nulled out when it opens up. The parent JSP(A.jsp) sends the request to the Action class which in turn runs some business logic and generates response data and sends the response back to B.jsp. B.jsp runs javascript function in its <body> tag and pops up C.jsp. A.jsp, B.jsp and C.jsp all use same actionmapping. But form attributes are empty only in C.jsp.

How do I resolve this ? Any hint would be appreciated.

Jyothi
Richard Golebiowski
Ranch Hand

Joined: May 05, 2010
Posts: 213

Is C.jsp generated from an action? Can we see the B.jsp Javascript that opens C.jsp?
Jyothi Venkatrao
Greenhorn

Joined: Aug 20, 2010
Posts: 4
No, C.jsp is not generated using an action class. The Javascript code snippet that opens the pop-up is.

mywindow = window.open("SerialNumbersSelection.jsp","mywindow",
"location=1,status=1,scrollbars=1,width=500,height=400");
mywindow.moveTo(0,0);

This javascript is called from B.jsp
Richard Golebiowski
Ranch Hand

Joined: May 05, 2010
Posts: 213

It needs to be generated by an action to be populated.
Jyothi Venkatrao
Greenhorn

Joined: Aug 20, 2010
Posts: 4
Yes, I agree that if the popup jsp gets generated using action class, the values would be populated. But I do not know how to make the actionforward to be a popup window.
So, this is what I tried. I am still using Javascript to open the popup window.

I am storing the values to be populated in the popup window in session and retrieving them in the C.jsp(popup window) and that seems to work.

Thanks,
Jyothi
Richard Golebiowski
Ranch Hand

Joined: May 05, 2010
Posts: 213

In window.open, call the action instead of the jsp.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Popup window using Struts