jeff1919
asked on
struts: how can the list being retrieved from new window
xxxaction.java already set the list such that session.setAttribute("xxxl ist", list). How can the list being retrieved from new window opened by javascipt newwin? Using <logic:iterate> to retrieve the list get null pointer exception.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
session.getAttribute("xxxl ist") also returns null in new window. Had no problem retrieved the data from the list in main window.
jstl is not allowed to use.
jstl is not allowed to use.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i have found new window contains different session id. Response.encodeURL returns the same url without attached session id on it. (ps: url = popupxxx.jsp)
So we're getting closer to the real problem :-)
Can you show us the command that creates the popup-code and the generated page source for the popup?
Also: What is the URL of the calling page (as displayed in your browser), do you use "<base href='...'>" in your page and what is the URL of the popup?
Can you show us the command that creates the popup-code and the generated page source for the popup?
Also: What is the URL of the calling page (as displayed in your browser), do you use "<base href='...'>" in your page and what is the URL of the popup?
ASKER
The following is the code calling the popup window.
<td width=100 height=20 class="font1" style="border-top:solid #336699 .5pt;border-bottom:solid #336699 .5pt;border-left:solid #336699 .5pt;border-right:solid #336699 .5pt;" bgcolor=Gold align=center><a href="#" onclick="javascript:newwin =window.op en('emlpri nt.jsp','h ','width=3 00px,heigh t=300px;') " onMouseOver="window.status ='Print';r eturn true;" onMouseOut="window.status= '';return true;" style="font-size:8pt">Prin t</a></td>
the list to be iterated is set in action class...the page contains above code can show the list correctly...that is, the list is not null before open the new window...
<td width=100 height=20 class="font1" style="border-top:solid #336699 .5pt;border-bottom:solid #336699 .5pt;border-left:solid #336699 .5pt;border-right:solid #336699 .5pt;" bgcolor=Gold align=center><a href="#" onclick="javascript:newwin
the list to be iterated is set in action class...the page contains above code can show the list correctly...that is, the list is not null before open the new window...
Pleeeeeeaaaase - I can not help you if you don't answer my question!
> What is the URL of the calling page (as displayed in your browser), do you use "<base href='...'>" in your page and what is the URL of the popup?
I've asked this twice already and it's VERY important!!!
Please check the URLs of the two pages from the browser "page information"...
> that is, the list is not null before open the new window...
well, it's not null after the new window opens either - but it is stored in the session and for some reason (probably related to cookies and domains), the popup has a different session and THAT session does (of course) NOT contain a list...
P.S.: never heard of CSS classes? The css code attached to a td looks horrible!
> What is the URL of the calling page (as displayed in your browser), do you use "<base href='...'>" in your page and what is the URL of the popup?
I've asked this twice already and it's VERY important!!!
Please check the URLs of the two pages from the browser "page information"...
> that is, the list is not null before open the new window...
well, it's not null after the new window opens either - but it is stored in the session and for some reason (probably related to cookies and domains), the popup has a different session and THAT session does (of course) NOT contain a list...
P.S.: never heard of CSS classes? The css code attached to a td looks horrible!
ASKER
The url for calling page is...http://localhost:9080/MasterList/control.do and the url for pop window is not shown in the browser. The code generates the pop up window is <a href="#" onclick="javascript:newwin =window.op en('emlpri nt.jsp','h ','width=3 00px,heigh t=300px;') " But I don't think url information is useful.
PS: i am not the one writing the css code.
PS: i am not the one writing the css code.
ASKER
the pop up window has different session and that session does not contain the list. if the list is called in that session, we get null exception. it's possible the list is null and cause the null exception. I just tried to eliminate this possiblity..
I'm a little bit confused by your last post... (language problems...): Do you mean the popup window is SUPPOSED to have a different session? You mean you want it that way? If so, let me know.
If not, PLEASE post the URL of the popup - you can get it from the window properties in the popup (which browser are you using?), even if there is no address bar.
One more shot in that direction:
You said you can display the list in the main window. Do that. And then change the address in the main window from http://localhost:9080/MasterList/control.do to http://localhost:9080/MasterList/emlprint.jsp
Let me know what happens...
If not, PLEASE post the URL of the popup - you can get it from the window properties in the popup (which browser are you using?), even if there is no address bar.
One more shot in that direction:
You said you can display the list in the main window. Do that. And then change the address in the main window from http://localhost:9080/MasterList/control.do to http://localhost:9080/MasterList/emlprint.jsp
Let me know what happens...
Does your <logic:iterate> work in the main window?
Do both windows use the same session? (i.e. if you're not using cookies, you have to pass the session in the URL, for example).
Just try "session.getAttribute("xxx
Other than that, there should be no problem printing the list in a popup window if it's stored in the session and not the request...