<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>
我已经在上面发布了我的代码。为了找到解决方案,我提到了这个链接 How to retain selected value in a dropdown list in the same jsp page? 但是上述链接中提供的解决方案在我的情况下不起作用。