Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] dynamic anchor tags, javascript, and JSP


  • From: javascript@xxxxxxxxxx (Jay Wright)
  • Subject: [Javascript] dynamic anchor tags, javascript, and JSP
  • Date: Fri, 15 Feb 2002 12:35:25 -0800

I have a web application written with jsp and a controller servlet.  I have
implemented a pop up window, that when completes it's task, uses clientside
java script to refresh it's opener and close itself.

<body onload="opener.location.href='/some/page';self.close();">

This works flawlessly.  At least it seems to.

However, when I add jsp code to this page, to refresh the opener and append
a dyanmically generated ANCHOR tag, it works perfectly well the first time,
but then fails to refresh the opener on subsequent tries.

<%
        String anchorString = (String) request.getAttribute("anchor");
        StringBuffer buf = new StringBuffer("");
        if (str!=null) buf.append("#").append(anchorString);
        System.out.println(buf.toString());
%>
<body
onload="opener.location.href='/some/page<%=buf.toString()%>';self.close();">


I KNOW that anchorString is not null, because I log it and it logs
correctly.  The first time this page is executed, it correctly refreshes the
opener (/some/page#anchor1), but the other attempts all fail to refresh,
leaving "/some/page#" in the browser address window, but never refreshing
the browser.

Any ideas why this might be?

Thanks,
Jay