Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Popup window using Struts

 
Jyothi Venkatrao
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 213
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is C.jsp generated from an action? Can we see the B.jsp Javascript that opens C.jsp?
 
Jyothi Venkatrao
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 213
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It needs to be generated by an action to be populated.
 
Jyothi Venkatrao
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 213
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In window.open, call the action instead of the jsp.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic