【发布时间】:2011-04-19 13:28:34
【问题描述】:
这可能非常简单,但我不明白我在哪里做错了。我有一个包含三个链接的表单,即 LogIn、SignUp 和 ForgotPassword。我使用 javascript document..action 使用简单的 switch 案例为这些链接设置操作。 Singup 和 ForgotPassword 分别指的是 singup.jsp 和 ForgotPassword.jsp,而 LogIn 链接指的是一个 servlet。我使用 web.xml 文件中给出的 url-pattern 作为目标。当我运行时,单击 sigin 时会出错。知道出了什么问题吗?
<script type="text/javascript">
function redirect(tid)
{
switch(tid)
{
case "a":
{
if(document.form.Username.value=='')
{
alert("Enter your username");
return false;
}
if(document.form.Password.value=='')
{
alert("Enter your password");
return false;
}
document.form.action="check" //check is the urlpattern defined for checkUser servlet
}
break;
case "b":
document.form.action="Signup.jsp"
break;
case "c":
document.form.action="Forgotpassword.jsp"
break;
}
}
</script>
【问题讨论】:
-
你能给我们看一些相关的源代码吗?否则很难说到底出了什么问题。
-
请参考贴出的代码
-
错误是这个 URL 不支持 HTTP POST 方法
标签: javascript jsp servlets