我现在使用dojo 操作一些数据,发现传到后台时数据成了如下所示
数据字典管理然后保存到数据库,所以数据库的字段就成了这样子了,这是以前的一个程序员写的。
但在页面上显示是正确的编码。
我想在Java代码里做一次转化再保存就好了!怎么转成就可以了!我使用 URLEncoder.encode(moduleDTO.getName(),"UTF-8");转了一下!出来的结果是
编码后:%26%2325968%3B%26%2325454%3B%26%2323383%3B%26%2320856%3B%26%2331649%3B%26%2329702%3B
数据字典管理然后保存到数据库,所以数据库的字段就成了这样子了,这是以前的一个程序员写的。
但在页面上显示是正确的编码。
我想在Java代码里做一次转化再保存就好了!怎么转成就可以了!我使用 URLEncoder.encode(moduleDTO.getName(),"UTF-8");转了一下!出来的结果是
编码后:%26%2325968%3B%26%2325454%3B%26%2323383%3B%26%2320856%3B%26%2331649%3B%26%2329702%3B
if(isEmpty($("#name").val())) {
$("#namespan").html("<font color='red'>模块名称不能为空!</font>");
return;
} else {
$("#namespan").html("");
}
if(isEmpty($("#sn").val())) {
$("#snspan").html("<font color='red'>模块标识不能为空!</font>");
return;
} else {
$("#snspan").html("");
}
dojo.io.bind({
url: "<s:url value='actions/moduleAction!update'/>",
method:"post",
formNode:dojo.byId("updateModule"),
preventCache:true,
load: function(type, data, evt) {
var selectedNode = getSelectedNode();
var props = {title:data};
selectedNode.edit(props);
selectedNode.Selected();
}
});
}<body >
<form action="actions/moduleAction!update" method="post" id="updateModule">
<input type="hidden" id="mid" name="moduleDTO.id" value="${module.id }">
<input type="hidden" id="mpid" name="moduleDTO.parentId" value="${module.parent.id}">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="table">
<tr>
<td colspan="4" class="tdEditTitle">修改模块</td>
</tr>
<tr>
<td class="tdEditLabel" >模块名称:<font color="red">*</font></td>
<td class="tdEditContent">
<input type="text" id="name" name="moduleDTO.name" value="${module.name }">
<span id="namespan"></span>
</td>
</tr>
<tr>
<td class="tdEditLabel" >模块标识:<font color="red">*</font></td>
<td class="tdEditContent">
<input type="text" id="sn" name="moduleDTO.sn" value="${module.sn }">
<span id="snspan"></span>
</td>
</tr>
<tr>
<td class="tdEditLabel" >模块地址:</td>
<td class="tdEditContent"><input type="text" id="url" name="moduleDTO.url" value="${module.url }">
</td>
</tr>
<tr>
<td class="tdEditLabel" >排序号码:</td>
<td class="tdEditContent"><input type="text" id="orderNo" name="moduleDTO.orderNo" value="${module.orderNo }"></td>
</tr>
<tr>
<c:if test="${cn:hasPermission(login.userId,'modulemanager',UPDATE) }">
<td colspan="4" class="editButton">
<input type="button" onclick="updateModule()" name="saveButton" id="updateModuleButton"
class="formButton" value="更新模块信息">
</td>
</c:if>
</tr>
</table>
</form>
</body>
解码后数据正常了再存入数据库
对应的汉字是 :“数据字典管理” 不清楚怎么转了!URLEncoder.decode(),我试过!不好使!