JSP is server coding. It cannot handle what you need, as far as I am aware. What you need is a client side language, which is what JavaScript is for. JSP could only handle it, for example (as far as I know), iuf after every letter the field is submitted with its value, and if the value is locked, then it could add the readonly attribute.

The code I provied will work in a .jsp page. However, since it is not JSP code, it can work equally as well on a .php, .html, .asp, etc ...