核心提示:以前配置web.xml都是自动生成的,昨天写一个关于使用servlet生成验证码的过程中,碰到了一个问题。就是在LoginLogincom.hu.servlet.LoginLogin/magic中的标...
以前配置web.xml都是自动生成的,昨天写一个关于使用servlet生成验证码的过程中,碰到了一个问题。
就是在
中的Login Login com.hu.servlet.Login Login /magic
在经过几次测试后,我发现
一般情况下我们都是在表单的action中使用的,
<form action="<%=request.getContextPath() %>/magic" method="post"> <input type="text" name="userName"> <input type="submit" value="提交"> </form>
也就是说
=request.getContextPath()
=request.getContextPath()