首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2EE开发 >

js中交付表单 action进不去

2013-10-27 
js中提交表单 action进不去这是jsp页面%@ page languagejava importjava.util.* pageEncodingutf

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;
}
}


表单
[解决办法]


function?gos(i)  ==>function?gos(i){
[解决办法]


function gos(){
        document.getElementById("theform").attr("action","testss").submit(); 
        }

[解决办法]
用这个,上面jquery用多了。。


document.getElementById('theform').action = "testss";
document.getElementById('theform').submit();

[解决办法]

<a href="javascript:gos()">首页</a>
//下面错误。
<a href="#" onclick="gos()" ;>首页</a>

热点排行