var obj = new Object();
obj.content = Ext.getCmp("content").getValue();
doExtAjax(
'<%=request.getContextPath()%>/systemAction.do?method=saveaffiche',
{data:Ext.util.JSON.encode(obj)}
public ActionForward saveaffiche(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
String data = request.getParameter("data");
/* 此处加断点,控制台取到的data为什么是
2011-12-07 15:14:40 706251 DEBUG [http-8080-5] org.apache.struts.util.ModuleUtils null - Get module name for path /systemAction.do
2011-12-07 15:14:40 706251 DEBUG [http-8080-5] org.apache.struts.util.ModuleUtils null - Module name found: default
2011-12-07 15:14:40 706251 DEBUG [http-8080-5] org.apache.struts.action.RequestProcessor null - Processing a 'POST' for path '/systemAction'
2011-12-07 15:14:40 706252 DEBUG [http-8080-5] org.apache.struts.util.RequestUtils null - Looking for ActionForm bean instance in scope 'request' under attribute key 'baseForm'
2011-12-07 15:14:40 706252 DEBUG [http-8080-5] org.apache.struts.util.RequestUtils null - Creating new ActionForm instance of type 'com.stone.net.forms.baseForm'
2011-12-07 15:14:40 706252 DEBUG [http-8080-5] org.apache.struts.util.RequestUtils null - --> com.stone.net.forms.baseForm@14dba7f
2011-12-07 15:14:40 706252 DEBUG [http-8080-5] org.apache.struts.action.RequestProcessor null - Storing ActionForm bean instance in scope 'request' under attribute key 'baseForm'
2011-12-07 15:14:40 706253 DEBUG [http-8080-5] org.apache.struts.action.RequestProcessor null - Populating bean properties from this request
2011-12-07 15:14:40 706253 DEBUG [http-8080-5] org.apache.commons.beanutils.BeanUtils null - BeanUtils.populate(com.stone.net.forms.baseForm@14dba7f, {data=[Ljava.lang.String;@f1399, method=[Ljava.lang.String;@1cfd41a})
2011-12-07 15:14:40 706253 DEBUG [http-8080-5] org.apache.commons.beanutils.BeanUtils null - setProperty(com.stone.net.forms.baseForm@14dba7f, data, [{"afficheid":"","caption":"sadas","begintime":"2011-12-07","endtime":"2011-12-08","content":"?sadfas","isactive":"1","userids":"1"}])
2011-12-07 15:14:40 706253 DEBUG [http-8080-5] org.apache.commons.beanutils.BeanUtils null - setProperty(com.stone.net.forms.baseForm@14dba7f, method, [saveaffiche])
*/
通过这个传入的数据,"content"内容在取值后存入数据库变成
"?+content"数据库content字段类型是NVCHAR2(4000)
传入类型是String这个问题可能出在哪儿。谢谢。本人新手,希望列位能回答得简单点。太专业的术语看不懂。
十分感谢!注:jsp页面和工程都是GBK编码。
保存的值是sadfs。
如果输入中文"你好",这里取到的是"?你好"。
保存完毕再读取,修改内容为"你好",再保存数据又变得正常了。
两次调用的方法都一样。