日期:2014-05-18  浏览次数:20796 次

JSP中如何控制两个提交按钮,分别转向不同JSP页?
不知道我以下的,可以实现标题所述?欢迎高手赐教
<%@page   contentType= "text/html;   charset=GBK "   language= "java "     errorPage= " "%>
<!DOCTYPE   HTML   PUBLIC   "-//W3C//DTD   HTML   4.01   Transitional//EN "   "http://www.w3.org/TR/html4/loose.dtd ">
<html>
<head>
<title> 输入自己的信箱及密码 </title>
<script   type= " "   language= "javaScript ">
function   write()    
    {      
    document.form2.action= "write.jsp ";      
    document.form2.submit();      
    }      
    function   receive()      
    {      
    document.form2.action= "receive.jsp ";          
    document.form2.submit();          
    }
function   isValid(){
    if   (document.form2.EmailAddress.value== " ")
    {   alert( "邮箱名不能为空 ");
        return   false;}
else
        if(document.form2.EmailPassword.value== " "){
    alert( "密码不能为空 ");
    return   false;
    }
else
return   true;
  }
</script>
<style   type= "text/css ">
    <!--
        .样式3   {color:   #FF3300;font-family:   "楷体_GB2312 ";font-size:   24px;}
        .样式5   {color:   #FF3300;   font-family:   "楷体_GB2312 ";   }
        .样式8   {color:   #FF3300;   font-family:   "楷体_GB2312 ";   font-size:   20px;   }

    -->
</style>
</head>
<jsp:include   page= "docustart.jsp "   flush= "true "> </jsp:include>
<body>
<form   name= "form2 "   action= " ">
<h1   class= "样式3 "> 请输入你的邮箱名,及该邮箱密码 </h1>
<p   class= "样式3 "> &nbsp; </p>
<p   align= "center "   class= "样式5 ">
    <span   class= "样式8 "> 邮箱地址: </span>
 
    <input   type= "text "   name= "emailAddress ">
</p>
<p   align= "center "   class= "样式5 ">
    <span   class= "样式8 "> 邮箱密码: </span>
    <input   type= "password "   name= "emailPassword ">
</p>
<p   class= "样式5 "   align= "center ">
<input   type= "Button "     value= "写邮件 "   onclick= "write() ">
&nbsp;&nbsp;
<input   type= "reset "   value= "重置 ">
&nbsp;&nbsp;
<input   type= "Button "     value= "收邮件 "   onclick= "receive() ">