How To Use Request.getparametervalues? May 30, 2024 Post a Comment I'm trying to pass an array from one jsp page to another using a hidden form. Here is the relevant code of my jsp files. string, request.getParameterValues will return string[] with length 1.If you want to send multiple players and you don't want to repeat element in your jsp, then concat the players with some special character like the following: document.getElementById("players").value=playernames.join("::"); CopyYou can get is as string in lineup.jsp and you can split it with the same special characters like the following:<% String players = request.getParameter("players"); String[] s = players.split("::"); %> CopySolution 2: String[] players = request.getParametervalues("nameOfTheHiddenField");Please try specifying a name for the hidden field and it will work.Solution 3: OK, s is null here hence s[0] throws NullPointerExceptionThe method getParameterValues() will generally come into picture if there is a chance of getting multiple values for any input parameter, this method will retrieve all of it values and return it as string array.but in your case I think you have only one value to fetch, use request.getAttribute and try to print the result i.e. s and not s[0]once s is not null , you can go for s[0] Share Post a Comment for "How To Use Request.getparametervalues?"