Request.getParameter returns input string: "undefined"

My encounter an input string: “undefined”.
Please help.

public ModelAndView handleRequestInternal(HttpServletRequest request,
			HttpServletResponse response) throws Exception {

   int rowsPerPage = 20;
   String rowsPerPageStr = request.getParameter("rowsPerPage");"rowsPerPageStr " + rowsPerPageStr);
   if (rowsPerPageStr != null) {
	rowsPerPage = Integer.parseInt(rowsPerPageStr);

My jsp page use javascript as follows:

window.location = "hwdisplay?rowsPerPage=" + rowsPerPage;

Eclipse Console output is:
rowsPerPageStr undefined
Servlet.service() for servlet hwmgr threw exception java.lang.NumberFormatException: For input string: “undefined”

Is rowsPerPage a Javascript or Java(JSP) variable. If it’s meant to Javascript it’s undefined and you need to set it. If it’s JSP you need to do:

window.location = "hwdisplay?rowsPerPage=" + <&#37;= rowsPerPage%>;