找了些网上的办法试了都不行test.htm:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="Scripts/jquery.js" type="text/javascript"></script>
<script src="Scripts/jquery.form.js" type="text/javascript"></script>
<script>
var options = {
beforeSubmit: showRequest, // pre-submit callback
success: showResponse // post-submit callback
};
function showRequest(formData, jqForm, options) {
var queryString = $.param(formData);
//alert('About to submit: \n\n' + queryString);
return true;
}
function showResponse(responseText, statusText) {
alert('status: ' + statusText + '\n\nresponseText: \n' + responseText +
'\n\nThe output div should have already been updated with the responseText.');
}
function ajaxform(form){
$(form).ajaxSubmit(options);
}
</script>
<title>无标题文档</title>
</head><body>
<form name="newsform" method="post" action="test.jsp">
<textarea name="content" id="content" cols="45" rows="5"></textarea>
<input type="button" name="button" id="button" value="按钮" onclick="ajaxform(newsform)" />
</form>
</body>
</html>test.jsp:
<%
String content=request.getParameter("content");
out.print("test.jsp get : "+content);
%>提交结果出现乱码,英文正常。。
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="Scripts/jquery.js" type="text/javascript"></script>
<script src="Scripts/jquery.form.js" type="text/javascript"></script>
<script>
var options = {
beforeSubmit: showRequest, // pre-submit callback
success: showResponse // post-submit callback
};
function showRequest(formData, jqForm, options) {
var queryString = $.param(formData);
//alert('About to submit: \n\n' + queryString);
return true;
}
function showResponse(responseText, statusText) {
alert('status: ' + statusText + '\n\nresponseText: \n' + responseText +
'\n\nThe output div should have already been updated with the responseText.');
}
function ajaxform(form){
$(form).ajaxSubmit(options);
}
</script>
<title>无标题文档</title>
</head><body>
<form name="newsform" method="post" action="test.jsp">
<textarea name="content" id="content" cols="45" rows="5"></textarea>
<input type="button" name="button" id="button" value="按钮" onclick="ajaxform(newsform)" />
</form>
</body>
</html>test.jsp:
<%
String content=request.getParameter("content");
out.print("test.jsp get : "+content);
%>提交结果出现乱码,英文正常。。
解决方案 »
- jquery的 $.ajax 方法一直ERROR~
- 两个转异字符“//”是什么意思
- jsp跳转到其它页面的同时如何传递参数?
- 研究发现用元素的id可以直接返回该元素,而不用调用getElementById()方法.但我一直没有找到w3官方的说明呢?大家有哪个知道吗
- 自动发email
- 关于正则表达式替换多个空格的问题
- 能否实现这样的效果:输入框能够透明,不遮挡渐变的背景。
- win2000pro环境定期自动把文件从c:复制到d:,用javascript或jscript或vbscript怎样实现?
- 如何用JS验证输入框只允许输入数字和小数点,且小数点不能超过1个?
- 页面中输入一个名称,查询按钮点击之后,从数据库中取值在页面展现
- vbscript转javascript
- 实现 自动触发Button1_Click 事件
下加入代码
<%@Page contentType="text/html;charset=gb2312" language="java"%>