求帮忙 为什么我的模糊查询输中文就查不出来
jsp代码<td>搜索:<selectname="searchName"><optionvalue="title">标题</option><optionvalue="ne...
jsp代码
<td> 搜索:<select name="searchName">
<option value="title">标题</option>
<option value="newstype">资讯类别</option>
<option value="author">作者</option>
</select>
<input type="text" name="searchValue" value="" size="10"/>
<input name="image" type="image" src="./images/newssearch.gif"
onClick="doSearch();">
<br/>
java代码
public static String TranEncodeTOUTF8(String value) {
StringBuffer sb = new StringBuffer();
sb.append(value);
String vasString="";
String vasUTF8="";
try {
vasString=new String(sb.toString().getBytes("utf-8"),"utf-8");
vasUTF8=URLEncoder.encode(vasString, "utf-8");
System.out.println("value转码" + vasUTF8) ;
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return vasUTF8;
} 展开
<td> 搜索:<select name="searchName">
<option value="title">标题</option>
<option value="newstype">资讯类别</option>
<option value="author">作者</option>
</select>
<input type="text" name="searchValue" value="" size="10"/>
<input name="image" type="image" src="./images/newssearch.gif"
onClick="doSearch();">
<br/>
java代码
public static String TranEncodeTOUTF8(String value) {
StringBuffer sb = new StringBuffer();
sb.append(value);
String vasString="";
String vasUTF8="";
try {
vasString=new String(sb.toString().getBytes("utf-8"),"utf-8");
vasUTF8=URLEncoder.encode(vasString, "utf-8");
System.out.println("value转码" + vasUTF8) ;
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return vasUTF8;
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询