My controller.java encounter an input string: "undefined".
Please help.

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

   int rowsPerPage = 20;
   String rowsPerPageStr = request.getParameter("rowsPerPage");
   logger.info("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"

The NumberFormatException tells you that what you used as argument is not a number. It also says that the value you passed is the String: undefined

threw exception java.lang.NumberFormatException: For input string: "undefined"

That would mean that the value of rowsPerPageStr is the String: "undefined": String rowsPerPageStr = request.getParameter("rowsPerPage"); So here:

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

The variable rowsPerPage has the value: "undefined"

Try putting some alerts and see what you pass as parameter:

alert(rowsPerPage);
window.location = "hwdisplay?rowsPerPage=" + rowsPerPage;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.