Hello,
The following code snippets only work with a page that has just been loaded. If I try to go back in the browser cache to the page, the onClick event doesn’t fire anymore, and I’m trying to figure out why. This is running on Linux under Tomcat 1.5.
Here’s my javascript function:
function writeURL(f, url)
{
document.forms[‘frm’+f].action=”../write_url.jsp?url=”+url;
document.forms[‘frm’+f].method=”post”;
document.forms[‘frm’+f].submit();
}
And an example of one of the forms on the page:
<form name=”<%=form_name%>”>
<b><a href=”<%=url%>” onClick=”writeURL(<%=i%>, <%=url%>’);”><%=Entities.encode(title)%></a></b>
And write_url.jsp:
<%@page import=”java.io.*”%>
<%
String url = request.getParameter(“url”);
String strPath = “/mounts/bachman/disks/0/rregalad/url-hits.txt”;
File strFile = new File(strPath);
BufferedWriter objWriter = new BufferedWriter(new FileWriter(strFile, true));
objWriter.write(url);
objWriter.newLine();
objWriter.flush();
objWriter.close();
%>
Help!!!