I’m trying to auto-populate a drop down list based on a request parameter. I’m fairly new to JSP so forgive me for the simple question.
The following works fine and displays the alert correctly:
alert('<%=request.getParameter("lang") %>');
So I know what I am trying to do is easy enough. But when I add this same logic in with my select statement using:
<option <c:if test="${request.getParameter(\"lang\")=='En'}"> selected="selected" </c:if> value="<c:out value="${english}"/>">English</option>
I get an exception saying “The function getParameter must be used with a prefix when a default namespace is not specified”.
I’m a little confused as to why this doesn’t work here…
Thanks in advance
request.getParameter()will not resolved by EL. Request parameter can be accessed using implicit variableparam. i.e,${param.lang}Change this
to