<form method="POST" action="editprofile.htm" name="admintypeForm">
<p><label class="left-col">Username:</label><input type="text" name="username" required value="${admindet.username}" placeholder=""></p>
<p><label class="left-col">First Name:</label><input type="text" name="firstname"value="${admindet.firstName}" placeholder=""></p>
<p><label class="left-col">Last Name:</label><input type="text" name="lastname"value="${admindet.lastName}" placeholder=""></p>
<input type="hidden" name="password"value="${admindet.password}" placeholder="">
<p><label class="left-col">Admin Type:</label><select name="admintype"><option value="administrator">Administrator</option><option value="moderator">Moderator</option></select></p>
<p class="text-center"><input type="submit" name="commit" value="Update" class="btn-green2 btn"></p>
</form>
I have posted my code above.To find a solution,I referred to this link How to retain selected value in a dropdown list in the same jsp page? but the solution provided in the above mentioned link does not work in my case.