在 jsp 中提交 form 表单到action ; 无刷新上传; 注意和servlet 上传区别;
来源:互联网 发布:nagios 监控windows 编辑:程序博客网 时间:2024/05/16 15:38
public String addEmployee() {
Employee e = new Employee();
e.setAge(age);
e.setBirthday(birthday);
e.setEmail(email);
e.setEmployeeNumber(employeeNumber);
e.setName(name);
if (orgid != null) {
Organise org;
try {
org = (Organise) this.organiseService.findById(orgid);
e.setOrganise(org);
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
e.setPassword(password);
e.setRole(role);
e.setSex(sex);
e.setTelphone(telphone);
this.employeeService.save(e);
ServletActionContext.getResponse().getWriter().print("<script>window.parent.uploadSuccess('success');</script>");
//getWriter().write("<script>window.parent.afterSumbmit(' not ok')</script>");
ServletActionContext.getResponse().getWriter().print("<script>window.parent.uploadSuccess('not ok');</script>");
return null; / / 返回值是null;
}
//---------------------------------------------------jsp 页面
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%
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 'test.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="styles.css">
-->
<script type="text/javascript">
function testsub(){
document.getElementById('myform').submit();
}
function uploadSuccess(msg){
alert(msg);
}
</script>
</head>
<body>
<iframe style="display: none" name="hiddenifr"></iframe> // ifram e 可以再form 里面或者外面都可以;;似乎没什么影响;
<form action="addEmployeeAction.action" method='post'
target='hiddenifr' id="myform">
<input name='employeeNumber' value='employeeNum'>
<input type ='button' onclick="testsub()">
</form>
</body>
</html>
- 在 jsp 中提交 form 表单到action ; 无刷新上传; 注意和servlet 上传区别;
- 关于form表单无刷新提交上传
- form表单无刷新上传文件
- form表单无刷新上传文件
- 无刷新文件上传 ajax提交表单
- 无刷新文件上传 ajax提交表单
- 无刷新文件上传 ajax提交表单
- jsp form 表单上传
- 无刷新提交form表单
- JSP无刷新上传
- struts2使用form表单无刷新上传文件
- html form表单提交action和url跳转到action有什么区别.
- ajax(iframe)无刷新提交表单、上传文件
- ajax(iframe)无刷新提交表单、上传文件
- form表单提交上传附件
- form表单提交到servlet
- 在JSP表单提交中怎样在Servlet中处理文件上传并且获取JSP页面传过来的一些参数
- 利用HttpClient模拟form表单将文件上传到Servlet
- Google面试题之战胜股市
- Could not initialize the application's security component
- 数据结构删除程序
- JSON
- 有些事情,真的没有你想的那么难
- 在 jsp 中提交 form 表单到action ; 无刷新上传; 注意和servlet 上传区别;
- 看到一个很好玩的代码显示~~~~来瞄瞄
- BAT 批处理脚本 教程
- 理解 JVM 如何使用 Windows 和 Linux 上的本机内存
- LCA(最近公共祖先)
- 编辑距离,最长公共子序列,最长公共子串,最长递增子序列
- suse linux集群加入AD域问题
- 日期工具类
- char*和CString转换