当前位置: 代码迷 >> J2EE >> js中交付表单 action进不去
  详细解决方案

js中交付表单 action进不去

热度:102   发布时间:2016-04-21 21:59:13.0
js中提交表单 action进不去
这是jsp页面

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
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>客户管理</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 href="css/logistics.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" >

function gos(i){
theform.action = "testss"; 
theform.submit();   // 无法转到这个ACTION
}
</script>
  </head>
  
<body>
<h2>客户管理</h2>
<fieldset>
<legend>查询条件</legend>
<form action="querys" method="post" name="theform" id="theform">
  <table border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td class="trTitle">单位名称:</td>
      <td><label for="textfield"></label>
        <input type="text" name="clientName" id="textfield" value="${models.clientName}"/></td>
      <td>&nbsp;&nbsp;&nbsp;</td>
      <td class="trTitle">客户编号:</td>
      <td><input type="text" name="clientId" id="textfield5" /></td>
      <td>&nbsp;&nbsp;&nbsp;</td>
      <td class="trTitle">电&nbsp;&nbsp;话:</td>
      <td><label for="textfield2"></label>
        <input type="text" name="telphone" id="textfield2" /></td>
    </tr>
    <tr>
      <td class="trTitle">客户分类:</td>
      <td><label for="select"></label>
        <select name="clientType" id="select">
          <option value="0">托运客户</option>
          <option value="1">收货客户</option>
        </select></td>
      <td>&nbsp;</td>
      <td class="trTitle">联系人姓名</td>
      <td><input type="text" name="linkmanName" id="textfield6" /></td>
      <td>&nbsp;</td>
      <td class="trTitle">简&nbsp;&nbsp;拼:</td>
      <td><input type="text" name="spellBJDX" id="textfield4" /></td>
    </tr>
   </table>
<input type="submit" name="button" id="button" value="查询" class="btn" />
       
</form>


<a href="#" onclick="gos()">首页</a>
</body>
</html>

STRUTS

  <action name="testss" class="Tests">
   <result name="success">/MyJsp.jsp</result>
  </action>


Action类

@Controller("Tests")
public class Tests extends ActionSupport{

public String execute(){

System.out.println("Tests我被调用了");

return SUCCESS;
}
}


表单

------解决方案--------------------
  相关解决方案