jsp中button与submit的用法
button:可以对返回的数据进行格式化,反应到页面上,可以用form表单序列化提交也可以不用form表单提交
<form id="addForm">
<input type="hidden" placeholder="用户id" id="id" name="id"/>
<input type="button" value="保存" onclick="addUser()">
<script type="text/javascript">
function addUser(){
$.ajax({
type:'post',
// data:$("#addForm").serialize(),
data:{id:$("#id").val()},
url:'<%=ctxPath%>/doSave',
success:function(data){
alert("保存成功!");
window.location.href='<%=ctxPath%>/home';
}
});
}
submit:form表单提交,无法对返回的数据进行格式化,必须form表单提交
<form id="addForm" method="post" action="<%=ctxPath%>/doSave">
<input type="hidden" placeholder="用户id" id="id" name="id"/>
<input type="submit" value="保存">
</form>
jsp中button与submit的用法的更多相关文章
- jsp中include的两种用法
JSP中的include的两种用法 1.两种用法 <%@ include file=” ”%> <jsp:include page=” ” flush=”true”/> 2.用 ...
- Web开发中button与submit区别
submit是button的一个特例,也是button的一种,它把提交这个动作自动集成了. 如果表单在点击提交按钮后需要用JS进行处理(包括输入验证)后再提交的话,通常都必须把submit改成butt ...
- jsp中button传值
onclick=location.href("linker.jsp?custno="+ from1.custno.value)或者onClick ="a()" ...
- jsp中button按钮单击莫名提交两次或刷新页面问题
<button id="btn"></button>目前还不知道原因但是在button标签中加上type="button"属性即可解决问 ...
- jsp中<c:if>标签的用法
<c:if test="${(tbl.column1 eq '值') and (tbl.column2 eq 'str')}"> <table>...< ...
- JSP中嵌入java代码方式以及指令
JSP中嵌入java代码的三种方式: (1)声明变量或方法 : <%! 声明; %> :慎重使用,因为此方法定义的是全局变量 (2)java片段(scriptlet): <% j ...
- button 和 submit 的区别
表单提交中button和submit的区别submit是button的一个特例,也是button的一种,它把提交这个动作自动集成了,submit和button,二者都以按钮的形式展现,看起来都是按钮, ...
- JSP中 input type 用法
JSP中 input type 用法 Input表示Form表单中的一种输入对象,其又随Type类型的不同而分文本输入框,密码输入框,单选/复选框,提交/重置按钮等,下面一一介绍. 1,type=te ...
- JSP中的include的两种用法
1.两种用法 <%@ include file=” ”%> <jsp:include page=” ” flush=”true”/> 2.用法区别 (1)执行时间上区别 < ...
随机推荐
- PyInstaller打包步骤简记
pyinstaller 下载地址:http://www.pyinstaller.org/ 下载后用cmd进入解压文件夹 python setup.py install 安装. 最近用pyinstall ...
- php usort 按照数组中的某个键值排序
//php usort 按照数组中的某个键值排序 如果第一个参数小于第二个参数 -> 返回小于0的整数如果第一个参数等于于第二个参数 -> 返回等于0的整数如果第一个参数大于于第二个参数 ...
- Zookeeper学习笔记
ZK ID存放路径 /tmp/zookeeper/myid
- 转:HAR(HTTP Archive)规范
HAR(HTTP Archive),是一个用来储存HTTP请求/响应信息的通用文件格式,基于JSON.这个格式的出现可以使HTTP监测工具以一种通用的格式导出所收集的数据,这些数据可以被其他支持HAR ...
- pdf拆分与合并
1.引用iTextSharp,用于拆分和合并pdf文件 using iTextSharp.text; using iTextSharp.text.pdf; 2.合并pdf //outMergeFile ...
- WPF打包32位和64位程序 运行在ghost WIN7上问题
WIN10,VS2015,编译平台"anycpu".WIN7系统为ghost版 1. 在.NET4.5下编译,程序打包以后,在WIN7上运行界面启动有3.4秒的延迟:将.NET版本 ...
- C/C++ 结构体 数组 简单输入输出
#include <stdio.h> #include <stdlib.h> struct student{ int num; ]; double dec; }; int ma ...
- mybatis里的foreach语句
相信用了Mybatis的朋友们,都曾有一个疑惑,就是foreach是怎么用的,下面我就简单讲讲我的理解: foreach主要用在SQL语句中迭代一个集合.foreach元素的属性主要由item,ind ...
- C++数组实现的循环队列
#include<iostream> #include <string> /* 功能:数组实现的循环队列,C++实现,学习参考 */ using namespace std; ...
- My Env
Font -- YaHei Consolas Hybrid YaHei ConsolasAsume that we put the font file in /usr/share/fonts/myfo ...