Hibernate 模糊查询中文乱码:项目中使用的各种编码都是UTF-8 ,JSP、Myeclipse、xml、属性配置文件,等。后台输出Hibernate语句如下:
- Hibernate: select orderinstr0_.id as id3_, orderinstr0_.userId1 as userId2_3_,
- orderinstr0_.instrumentName as instrume3_3_, orderinstr0_.instrumentDescription as instrume4_3_, orderinstr0_.userId2 as userId5_3_, orderinstr0_.specification as specific6_3_,
- orderinstr0_.instrumentAddr as instrume7_3_, orderinstr0_.manufacturer as manufact8_3_, orderinstr0_.status as status3_,
- orderinstr0_.instrumentPic as instrum10_3_, orderinstr0_.reservationInformation as reserva11_3_,
- orderinstr0_.SchInPrice as SchInPrice3_, orderinstr0_.SchOutnPrice as SchOutn13_3_, orderinstr0_.price as price3_,
- orderinstr0_.buyTime as buyTime3_, orderinstr0_.enableSTime as enableS16_3_,
- orderinstr0_.enableETime as enableE17_3_, orderinstr0_.enableTime as enableTime3_,
- orderinstr0_.serviceFor as serviceFor3_ from orderSys.dbo.order_instrument orderinstr0_ where orderinstr0_.instrumentName like '%??????%' <!--此处获取的是乱码-->
查找了半天,后来仔细一看,发现没有写method方法!如果没有写method,那么form默认的值就是 method="get".
- <form action="/OrderSys/instrument/morelikelist.action"
- theme="simple" method="get"><!-- method不写乱码 \改成get也是乱码,默认就是get-->
- <input id="searchContent" name="d" type="text"
- class="input_border" value="输入名称或型号..." size="25"
- onfocus="this.value=''" />
- <select id="leixing" name="s" class="input_border"
- style="height: 20px; padding-top: 2px;">
- <option value="instrumentName">
- 仪器名称
- </option>
- <option value="specification">
- 仪器型号
- </option> </select>
- <input style="cursor: pointer;" name="" type="button" id="tijiao"
- value="" onclick="this.blur();submit();" />
- </form>
关于get 和 post 的区别:请google.
本文转自 w156445045 51CTO博客,原文链接: 本文转自 w156445045 51CTO博客,原文链接:,如需转载请自行联系原作者
,如需转载请自行联系原作者