我提交图片传不到后台,试过网上写的方法结果也是一样,干脆用框架里的写法贴上来求博友帮帮忙看下
jsp页面:
<%@page import="com.router.zhihui.usermanager.entity.Userinfo"%>
<%@page import="com.opensymphony.xwork2.ActionContext"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<%
Userinfo userinfo = (Userinfo) ActionContext.getContext()
.getSession().get("userinfo");
String username = userinfo.getUsername();//取出登陆用户名
%>
<script type="text/javascript">
function publishNow(){
var username = "<%=username%>";
document.getElementById("form").action = "propertyPublishNotice?username="+username;
document.getElementById("form").submit();
}
function publishDelay(){
var username = "<%=username%>";
document.getElementById("form").action = "propertyDelayPublishNotice?username="+username;
document.getElementById("form").submit();
}
</script>
</head>
<body>
<div class="pageContent" id="top" style="margin-left: 20px;">
<div style="font-weight: bolder;margin-top: 20px;">发布公告</div>
<div class="panel-body" style="float: left;">
<form method="post" id="form" action=""
onsubmit="return iframeCallback(this);">
<div class="form-group">
<br /> <label> <input type="text" class="form-control"
id="title" name="noticetitle" placeholder="公告标题"
style="width: 400px;"> </label>
</div>
<br /> <br />
<div class="form-group">
<textarea id="editor"
style="width: 700px; height: 300px; line-height: 20px;"
placeholder="公告正文" name="noticeContent"> </textarea>
</form>
<br /> <br />
/*
下面是上传域
*/
<input id="testFileInput2" type="file" name="image2"
uploaderOption="{
swf:'uploadify/scripts/uploadify.swf',
uploader:'uploadPhoto.action?username=<%=username%>',
formData:{PHPSESSID:'xxx', ajax:1},
queueID:'fileQueue',
buttonImage:'uploadify/img/add.jpg',
buttonClass:'my-uploadify-button',
width:102,
auto:false
}"
/>
//上传按钮
<input type="image" src="uploadify/img/upload.jpg" onclick="$('#testFileInput2').uploadify('upload', '*');"/>
<br />
<br />
<font class="divider"></font>
</div>
</div>
<div id="fileQueue" class="fileQueue" style="float: left;"></div>
<div class="form-inline" style="clear:both;">
<button class="btn btn-primary" id="btnpublish" style="color:olive;"
onclick="publishNow();">立即发布</button>
<button class="btn btn-primary" id="btnpublish" style="color:olive;"
onclick="publishDelay();">预发布</button>
<span style="margin-left: 100px;"> <input type="checkbox"
id="mail" checked="checked"> <a href="javascript:void(0)"
id="mailconfig">通知业主</a> </span>
</div>
</div>
</body>
</html>