Spring3MVC请求获取不到!郁闷!

Jackie_GP 2011-10-27 09:43:00
2011-10-27 21:39:23 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet [spring3mvc] in context with path [/BBS] threw exception [Request method 'POST' not supported] with root cause
org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'POST' not supported


Spring3MVC用Jquery的ajaxfileupload.js组件上传,死活找不到Controller,报告上面的错误!(FckEditor中添加插件)


@Controller
@RequestMapping("/fck")
public class FckImportWordController
{
@Autowired
SiteInfoDao siteInfoDao;

@RequestMapping(value = "/importWord.gp", method = RequestMethod.POST)
public void importWord(HttpServletRequest request, HttpServletResponse response, String filedata) throws IOException
{
。。。
}
}



指定了请求方式。
html文件如下:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Code Properties</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta content="noindex, nofollow" name="robots">
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="ajaxfileupload.js"></script>
<script type="text/javascript" src="importword.js"></script>
</head>
<body scroll="no" style="OVERFLOW: hidden">
<table height="100%" width="95%" align="center">
<tr height="40">
<td>
<input type="file" name="filedata" id="filedata">
<input type="button" id="refer" value="导入" />
</td>
</tr>
</table>
</body>
</html>



js代码如下:

var oEditor = window.parent.InnerDialogLoaded();
var FCKLang = oEditor.FCKLang;
var FCKCodes = oEditor.FCKCodes;
oEditor.FCKLanguageManager.TranslatePage(document);
$(document).ready(function()
{
$("#refer").click(function()
{
alert("上传");
$.ajaxFileUpload(
{
url : "../fck/importWord.gp",
secureuri : false,
fileElementId : 'filedata',
dataType : 'text',
success : function(data, status)
{
if (typeof data != undefined)
{
if (data == "e")
{
alert("类型错误,只能是word类型的!");
}
else if(data == "kong")
{
alert("请选择Word文件!");
}
else
{
oEditor.FCK.InsertHtml(data);
window.parent.Cancel(true);
}
}
},
error : function(data, status, e)
{
alert("error" + status);
}
});
});
});



请遇到类似问题的高手,帮我解决一下呀!谢谢!
...全文
335 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
scarlett_li 2011-11-01
  • 打赏
  • 举报
回复
缺少form表单...

<form method="post" enctype="multipart/form-data" name="frmUpload" type="file" action="/xxx.do">
Jackie_GP 2011-10-27
  • 打赏
  • 举报
回复
郁闷我一天了!!!

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧