I can get the value of a textfield from html to java using the following code:
String id = request.getParameter("id");
Is there a way where I can set an HTML text field using a Java code?
Just let JSP/EL print it in the value
attribute of the field.
<input type="text" name="id" value="${param.id}" />
or, better, to avoid XSS attacks, use JSTL fn:escapeXml()
.
<input type="text" name="id" value="${fn:escapeXml(param.id)}" />