正常情况下form表单提交会把表单内的内容提交到后台,但是如果有些内容只是作为展示或者是标记而不想传到后台,我们采用如下方法:

jsp页面如下,我们不想提交id为userIdMark和pwdMark的input框的值到后台,所以我们需要在提交时设置input框的属性为disabled,

这样当表单提交时,他们的值就无法提交到后台,从而达到目的

<form action="${path }/manage/logon.do" method="post" id="logonForm">
  <table cellpadding="0" cellspacing="0" border="0">
    <tr height="50">
      <td>
        <input type="text" id="userIdMark" name="userIdMark" style="line-height:20px; height:20px;width: 150px;"/>
        <input type="hidden" id="userId" name="userId" style="line-height:20px; height:20px;width: 150px;"/>
      </td>
    </tr>
    <tr height="50">
      <td>
        <input type="password" id="pwdMark" name="pwdMark" style="line-height:20px; height:20px;width: 150px;"/>
        <input type="hidden" id="pwd" name="pwd" style="line-height:20px; height:20px;width: 150px;"/>
      </td>
    </tr>
    <tr height="60">
      <td>
        <a href="#" id="logon" name="submit" class="login_btn"></a>
      </td>
    </tr>
  </table>
</form>

js代码:

$("#logon").click(function(){
document.getElementById("userId").value = "admin";
document.getElementById("pwd").value = "1";
$("#userIdMark").attr("disabled","disabled");
$("#pwdMark").attr("disabled","disabled");
$("#logonForm").submit();
});

这样后台就只能接收id为userId和pwd的的值,无法接收id为userIdMark和pwdMark的值了

form表单提交时选择性传值到后台的更多相关文章

  1. jQuery判断 form表单提交时一些文本框的判断

    一: form表单提交时如果表单里有input标签为空那么不提交form表单. <head> <script type="text/javascript"> ...

  2. php form表单提交时,action url中参数无效的解决方法

    表单提交时get方式的一个错误 <form class="form-inline pull-right" method="get" action=&quo ...

  3. springboot框架中集成thymeleaf引擎,使用form表单提交数据,debug结果后台获取不到数据

    springboot框架中集成thymeleaf引擎,使用form表单提交数据,debug结果后台获取不到数据 表单html: <form class="form-horizontal ...

  4. 【教训】 form表单提交时,action url中参数无效

    今天提交一个表单,内容参考如下: <form action="add.php?a=123&b=456">     <input type="hi ...

  5. form表单提交时,action怎么带参数

    <html> <title>form</title> <script type="text/javascript"> functio ...

  6. form表单提交时action路劲问题

    项目总出现window上部署可以访问,linux下部署不能访问的问题 linux下访问action必须是全路径,可以加上“${pageContext.request.contextPath}”  便可 ...

  7. form表单提交target属性使用

    通过form表单提交刷新iframe <form action="doctor/selPackage" target="projectlistframe" ...

  8. 关于form表单提交ajaxForm和ajaxSubmit的用法与区别

    前几天在学习form表单提交时看到这两种方法,这两种方法都是实现form的ajax提交的方法,看了很多资料还是不太明白其用法和区别,最后直接自己写demo,很快就理解,所以说实操是学习的最快捷直接的途 ...

  9. SpringMVC中使用bean来接收form表单提交的参数时的注意点

    这是前辈们对于SpringMVC接收表单数据记录下来的总结经验: SpringMVC接收页面表单参数 springmvc请求参数获取的几种方法 下面是我自己在使用时发现的,前辈们没有记录的细节和注意点 ...

随机推荐

  1. hdu 1533(最小费用最大流)

    Going Home Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total ...

  2. hdu 1671(字典树判断前缀)

    Phone List Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total ...

  3. 更换163的yum源

    1.利用oss的文件目录形式进行各地项目的汇总保存.上报在A目录,统计过的放到B目录. 2.各地服务器健康状态检查,每5分钟检查项目,    如果有异常,就发短信+邮件进行汇报.不管是不是有异常,都以 ...

  4. Prometheus exporter的Node exporter是可以独立安装,用来测试的

    现在慢慢在把prometheus operator的一些概念组织完整. https://github.com/coreos/prometheus-operator/tree/master/contri ...

  5. 安卓APP安全测试基础

    学习牛人经验,结合自己的测试,做简单总结: 简介:安卓APP安全测试目前主要覆盖以下方面:1)自身组件安全2)本地敏感数据保护3)web接口安全 一.自身组件安全目前手动.开源或免费工具均能检测此类漏 ...

  6. Linux打包压缩

    zip: 打包:zip something.zip something (目录请加 -r 参数) 解包:unzip something.zip 指定路径:-d 参数 tar: 打包:tar -zcvf ...

  7. 架构设计之NodeJS操作消息队列RabbitMQ

    一. 什么是消息队列? 消息(Message)是指在应用间传送的数据.消息可以非常简单,比如只包含文本字符串,也可以更复杂,可能包含嵌入对象. 消息队列(Message Queue)是一种应用间的通信 ...

  8. apache 占用内存总量与每个apache进程的平均内存占用量计算

    方法1: ps aux | grep httpd | grep -v pts | awk '{ tot += $6; procs += 1; print $2,$6,$11 } END { print ...

  9. Codeforces 1131 A. Sea Battle-暴力 (Codeforces Round #541 (Div. 2))

    A. Sea Battle time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  10. Shiro源码分析之Subject和SecurityManager

    Subject 毫无疑问,Subject是Shiro最重要的一个概念. “Subject”只是一个安全术语,意味着应用程序用户的特定于安全性的“视图”.Shiro Subject实例代表单个应用程序用 ...