<%@ page contentType="text/html;charset=UTF-8" language="java" %> <html> <head> <title>$Title$</title> </head> <script type="text/javascript"> function reloadCode() { var time=new Date().getTime(); document.getElementById("imagecode").src="<%= request.getContextPath()%>/servlet/ImageServlet?d="+time; } </script> <body> <form action="<%= request.getContextPath()%>/servlet/UserServlet" method="post" > 用户名:<input type="text" name="uname"/> <br> 密码:<input type="password" name="password"/> <br> 验证码:<input type="text" name="checkCode"/> <a href="javascript:reloadCode();"> <img alt="验证码" id="imagecode" src="<%= request.getContextPath()%>/servlet/ImageServlet"/> 看不清楚</a><br> <input type="submit" value="登录"> </form> </body> </html>