I am calling a servlet from a javascript using the following code:
pageUrl = "/servlet/Main?ReportID=ADD&year=" + year1 + "&field2=" + field2 (etc, etc, etc)
location.replace('" "');
window.location = pageUrl;
return true:
i use this code all the time, but this time I am sending TONS of data, and it errors on the window.location line. I am pretty sure it's because of the amount of data that I'm sending via the url. I tested by limiting the amount of data and it works, but when I send all the data that is needed, it freaks out
with a javascript error that can't be captured and gives me a "page not found" error with the following in the url:
/servlet/"%20"
when it should be /servlet/Main?ReportID=ADD&year=2004&field2=field2 (etc, etc, etc)
Is there a limit to the amount of characters in a url? And if so, how can I pass all my data to the servlet using a javascript? Can I use putsession commands in a servlet?
HELP!
So in your case it javascript can be:
document.hh.ReportID.value
document.hh.year.value="20
document.hh.field2.value="
//...
document.hh.submit();
and HTML:
<form name="hh" method="POST" action="/servlet/Mail">
<input type="hidden" name="ReportID"/>
<input type="hidden" name="year"/>
<input type="hidden" name="field2"/>
<!-- add other input elements for other parameters -->
</form>