Access Get parameter with a scriptlet
问题 I hava a url such as search.do?offset=20 offset sometimes is in the url sometimes not. When it is not in the URL i want it to be 0. i try, without success, to retrieve the value with a scriptlet as follows: <% Integer offset = (pageContext.findAttribute("offset")==null) ? new Integer("0") : new Integer((String) pageContext.findAttribute("offset")); %> Anyone knows what i am doing wrong? 回答1: You should use this instead. <% Integer offset = request.getParameter("offset") != null && request