After submitting data in the HTML from, a servlet adds these data to my DB and forwards a result message to a JSP page. I want to retain the initially submitted values in the form after the forward.
Is it sensible to make an object in a servlet and add all the parameters I receive and send it with a request to JSP? Is there another better way?
For the select statement maybe you can just use javascript.
document.getElementById('baz').value = '${param.baz}';
You could access single-value request parameters by
${param}
.Do note that JSTL's
fn:escapeXml()
is necessary in order to prevent XSS attacks. See also XSS prevention in JSP/Servlet web application.You could access multi-value request parameters by
${paramValues}
and EL 3.0 streams.