当前位置: 代码迷 >> Java Web开发 >> struts2 表单中两个<s:submit>按钮,怎么能让一个按钮对应
  详细解决方案

struts2 表单中两个<s:submit>按钮,怎么能让一个按钮对应

热度:3814   发布时间:2013-02-25 21:10:28.0
struts2 表单中两个<s:submit>按钮,如何能让一个按钮对应
html代码如下:3处红色部分,我想让<s:form>中的submit方法对应一个<s:submit>按钮,而另一个<s:submit>按钮不去执行<s:form>中的submit方法,应该怎么做?大侠救救我
-----------------------------------------------------------
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
 
  <base href="<%=basePath%>">
  <title>My JSP 'addCategory.jsp' starting page</title>
   
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">  
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link rel="stylesheet" type="text/css" href="css/manage.css">
<s:head/>
<script type="text/javascript" src="js/test.js"></script>

<script type="text/javascript">
  djConfig = {
  isDebug: false,
  parseOnLoad: true
  };
  </script>
<script type="text/javascript" src="js/dojo/dojo.js">
</script>

<script>

  
  //验证
 function checkform(){
  var isPass = true;  
  
  if(!(checkData.isEmptySpan("diretetile")&&checkData.trim("diretetile") && checkData.filterStrSpan('diretetile','#$%$'))) {  
  isPass = false;  
  }  

 if(!(checkData.isEmptySpan("isAuthor") && checkData.filterStrSpan('isAuthor','#$%$'))) {  
  isPass = false;  
  }  
 //检查url  
  if(!(checkData.isEmptySpan("isURL") && checkData.isURLSpan('isURL'))){  
  isPass = false;  
  }
 //selectitem1
 if(!(checkData.isNumSpan('selectitem1'))){  
  isPass = false;  
 }
 
 
 
 return isPass;
 
 }
 
</script>


  </head>
  
  <body> 
   


  <div class="myform">
  <h1 class="myli">目录修改页面</h1>
  <s:form action="submitDirectory.action" method="POST" onsubmit="return checkform();">
   
  <p></p>
  <input type="hidden" name="dire.uuid" value='<s:property value="dire.uuid"/>'/>

  <tr>
  <td><lable class="mylable">目录名称:</lable></td>
  <td><s:textfield name="dire.title" cssClass="myinput" id="diretetile" theme="simple"/></td><br/>
  </tr>
   
  <tr>
  <td><lable class="mylable">目录链接: </lable></td>
  相关解决方案