.. and redirected to the same JSP page ..
, .
response.sendRedirect("page.jsp");
request.getRequestDispatcher("page.jsp").forward(request, response);
, , . , , , .
JSP ${param} EL, ${attributeKey}, attributeKey - , :
request.setAttribute("attributeKey", someObject);
HTML JSP, <input> value :
<input name="foo" value="${param.foo}">
request.getParameter("foo") . XSS, JSTL fn:escapeXml() :
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
...
<input name="foo" value="${fn:escapeXml(param.foo)}">
- . selected <option>. , , , , JSTL <c:forEach> Map<String, String> , , List<JavaBean>, (, ${countries} Map<String, String> , ):
<select name="country">
<c:forEach items="${countries}" var="country">
<option value="${country.key}" ${country.key == param.country ? 'selected' : ''}>${country.value}</option>
</c:forEach>
</select>
selected, , .