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 (Filipiak, Bob (Contractor))
  • Subject: [Javascript] dynamic anchor tags, javascript, and JSP
  • Date: Fri, 15 Feb 2002 15:44:57 -0500

This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C1B661.A1325D80
Content-Type: text/plain;
	charset="iso-8859-1"


Just a thought but it may be that once you go to the Anchor tag the browser
doesn't reload because the "#...." incdicates a location on the current
page.
Bob Filipiak
(Contractor)

-----Original Message-----
From: Jay Wright [mailto:jwright@xxxxxxxx]
Sent: Friday, February 15, 2002 3:35 PM
To: 'javascript@xxxxxxxxxx'
Subject: [Javascript] dynamic anchor tags, javascript, and JSP



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

_______________________________________________
Javascript mailing list
Javascript@xxxxxxxxxx
https://lists.LaTech.edu/mailman/listinfo/javascript

------_=_NextPart_001_01C1B661.A1325D80
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2652.35">
<TITLE>RE: [Javascript] dynamic anchor tags, javascript, and =
JSP</TITLE>
</HEAD>
<BODY>
<BR>

<P><FONT SIZE=3D2>Just a thought but it may be that once you go to the =
Anchor tag the browser doesn't reload because the &quot;#....&quot; =
incdicates a location on the current page.</FONT></P>

<P><FONT SIZE=3D2>Bob Filipiak</FONT>
<BR><FONT SIZE=3D2>(Contractor)</FONT>
</P>

<P><FONT SIZE=3D2>-----Original Message-----</FONT>
<BR><FONT SIZE=3D2>From: Jay Wright [<A =
HREF=3D"mailto:jwright@xxxxxxxx";>mailto:jwright@xxxxxxxx</A>]</FONT>
<BR><FONT SIZE=3D2>Sent: Friday, February 15, 2002 3:35 PM</FONT>
<BR><FONT SIZE=3D2>To: 'javascript@xxxxxxxxxx'</FONT>
<BR><FONT SIZE=3D2>Subject: [Javascript] dynamic anchor tags, =
javascript, and JSP</FONT>
</P>
<BR>
<BR>

<P><FONT SIZE=3D2>I have a web application written with jsp and a =
controller servlet.&nbsp; I have</FONT>
<BR><FONT SIZE=3D2>implemented a pop up window, that when completes =
it's task, uses clientside</FONT>
<BR><FONT SIZE=3D2>java script to refresh it's opener and close =
itself.</FONT>
</P>

<P><FONT SIZE=3D2>&lt;body =
onload=3D&quot;opener.location.href=3D'/some/page';self.close();&quot;&g=
t;</FONT>
</P>

<P><FONT SIZE=3D2>This works flawlessly.&nbsp; At least it seems =
to.</FONT>
</P>

<P><FONT SIZE=3D2>However, when I add jsp code to this page, to refresh =
the opener and append</FONT>
<BR><FONT SIZE=3D2>a dyanmically generated ANCHOR tag, it works =
perfectly well the first time,</FONT>
<BR><FONT SIZE=3D2>but then fails to refresh the opener on subsequent =
tries.</FONT>
</P>

<P><FONT SIZE=3D2>&lt;%</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String =
anchorString =3D (String) =
request.getAttribute(&quot;anchor&quot;);</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
StringBuffer buf =3D new StringBuffer(&quot;&quot;);</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if =
(str!=3Dnull) buf.append(&quot;#&quot;).append(anchorString);</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
System.out.println(buf.toString());</FONT>
<BR><FONT SIZE=3D2>%&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;body</FONT>
<BR><FONT =
SIZE=3D2>onload=3D&quot;opener.location.href=3D'/some/page&lt;%=3Dbuf.to=
String()%&gt;';self.close();&quot;&gt;</FONT>
</P>
<BR>

<P><FONT SIZE=3D2>I KNOW that anchorString is not null, because I log =
it and it logs</FONT>
<BR><FONT SIZE=3D2>correctly.&nbsp; The first time this page is =
executed, it correctly refreshes the</FONT>
<BR><FONT SIZE=3D2>opener (/some/page#anchor1), but the other attempts =
all fail to refresh,</FONT>
<BR><FONT SIZE=3D2>leaving &quot;/some/page#&quot; in the browser =
address window, but never refreshing</FONT>
<BR><FONT SIZE=3D2>the browser.</FONT>
</P>

<P><FONT SIZE=3D2>Any ideas why this might be?</FONT>
</P>

<P><FONT SIZE=3D2>Thanks,</FONT>
<BR><FONT SIZE=3D2>Jay</FONT>
</P>

<P><FONT =
SIZE=3D2>_______________________________________________</FONT>
<BR><FONT SIZE=3D2>Javascript mailing list</FONT>
<BR><FONT SIZE=3D2>Javascript@xxxxxxxxxx</FONT>
<BR><FONT SIZE=3D2><A =
HREF=3D"https://lists.LaTech.edu/mailman/listinfo/javascript"; =
TARGET=3D"_blank">https://lists.LaTech.edu/mailman/listinfo/javascript</=
A></FONT>
</P>

</BODY>
</HTML>
------_=_NextPart_001_01C1B661.A1325D80--