Post表单提交TextArea的值出现转译乱码问题 - Spring MVC处理表单提交

1. 使用Spring MVC处理表单的提交。

2. 表单的提交方式为Post方式。

3. 在textArea中输入的提交的内容为:

NodeServer[@hostName in("sj-wv00-3854129.sjc.ebay.com","sj-wv00-6257537.sjc.ebay.com","ph-wv00-ed62fb7.phx.ebay.com","ph-wv00-fdc3389.phx.ebay.com","sj-wv00-3534570.sjc.ebay.com","sj-wv00-4af5961.sjc.ebay.com","ph-wv-839a237.phx.ebay.com","px-wv00-963e8e2.phx.ebay.com","px-wv00-86066a2.phx.ebay.com","px-wv00-42a0822.phx.ebay.com")]

4.提交到Spring MVC Controller中内容 为(类的相关属性)为:

ÂNodeServer[@hostName in("sj-wv00-3854129.sjc.ebay.com","sj-wv00-6257537.sjc.ebay.com","ph-wv00-ed62fb7.phx.ebay.com","ph-wv00-fdc3389.phx.ebay.com","sj-wv00-3534570.sjc.ebay.com","sj-wv00-4af5961.sjc.ebay.com","ph-wv-839a237.phx.ebay.com","px-wv00-963e8e2.phx.ebay.com","px-wv00-86066a2.phx.ebay.com","px-wv00-42a0822.phx.ebay.com")]

5. 表单内容为:

 

<form id="createRuleForm" name="createRuleForm" action="validator/createRule" method="post">
	<input type="hidden" id="cmsClass" name="cmsClass"></input> 
	<input type="hidden" id="odbClass" name="odbClass"></input>
<!-- <input type="hidden" id="attributes" name="attributes"></input> -->
	
	<!-- attributesDiv used to append the inputs of the attributes, and submitted to Server Side-->
	<div id="attributesDiv" title="Please select attrs."></div>
	
	<div class="container-fluid">
		<label class="pull-left"><strong>Rule Name</strong></label> <input name="name" id="name" class="pull-right span3" type="text"
			placeholder="Rule Name..." title="Please fill in the rule name."></input>
	</div>
	<div class="container-fluid">
		<label class="pull-left"><strong>Creator</strong></label> <input name="creator" id="creator" class="pull-right span3" type="text"
			placeholder="Creator..." title="Please fill in the creator name."></input>
	</div>
	<div class="container-fluid">
		<label class="pull-left"><strong>ODB Collection</strong></label>
		<input name="odbCollection" id="odbCollection" class="pull-right span3" type="text" placeholder="Enter the collection NAME..." title="Please fill in the ODB collection name."></input>
	</div>
	<div class="container-fluid">
		<label class="pull-left"><strong>CMS Query</strong></label>
		<textarea name="cmsQuery" id="cmsQuery" class="pull-right span3" placeholder="The format should be like..." title="Please fill in the CMS query."></textarea>
	</div>
<input class="pull-left btn-warning" type="reset" value="reset" οnclick="classOnchange();"></input>
<input class="pull-right btn-primary" type="submit" value="submit" οnclick="return handleForm();"></input>
</form>

 

可能的原因

1)没有在表单上统一设置编码

解决办法:

只需要在该页面上指定编码为UTF-8:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

 

2. 在往textArea中写内容的时候,在开始输入了空格,会被转译成Â

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值