现在对方服务器返回的内容中含有<br/>,在我的页面中直接显示为<br/>。action中我这样处理Result3.replaceAll("<br/>", "");但是没起作用,这是什么原因啊?
解决方案 »
- jsp中如何把doc文档转化为html页面?
- ids for this class must be manually assigned before calling save(): org.hiberna
- jboss 5.0 GA如何配置oracle10g数据库连接池.急!
- 服务器同一脚本会被重复下载吗
- struts2 里面怎么判断 Action里的2个值,急啊!~~~~~~~~~
- 求教高手javaBena+jsp显示数据库中的信息 ([Microsoft][ODBC SQL Server Driver]无效的描述符索引)
- 不知用什么才搞定的
- 在jsp页面中如何读取oracle数据库中的clob字段
- 初学问题
- 怎么把sql server 2000数据库中的char等数据类型转换成sql查询语句中的string类型?高分有请!!!
- JSP生成XML文档
- 非局域网如何访问myeclipse上的网站
试试
如果有的话,可能是你前面加了空格的原因,大小写也要注意
手机号:1590058****<br/>
归属地:上海<br/>
卡类型:移动全球通卡<br/>
Result3.replaceAll("<br/>", "");这种方法是行不通的啊
把关于这个地方的的代码贴下
client.getHostConfiguration().setHost( "wap.l.cn" , 80, "http" );
HttpMethod method;
try {
method = Mobile.getGetMethod(tel);
try {
client.executeMethod(method);
String Result2=new String(method.getResponseBodyAsString());
String[] Result3 = Result2.split("\n");
Result = new String[Result3.length];
int i = "<br/>".length();
for(int j=0;j<Result3.length;j++){
for(int t=0;t<Result3[j].length()-i;t++)
{ if(Result3[j].regionMatches(0,"<br/>",0,i)==true)
Result3[j].replaceAll("<br/>", "");}
Result[j] = Result3[j];
}
method.releaseConnection();
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return SUCCESS;
}
“\<”代替“<”
“\>”代替“>”
“\/”代替“/”
试试看
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card title="乐活-[北京]">
<p>
<a href="/tel/tel_index.php?city_id=010&sid=&tuid=22128034">归属地</a>->查询结果
<br/>
手机号码归属地查询<br/>
<input name="tel" maxlength="50" value="" size="19"/><br/>
><anchor>查询
<go method="get" href="/tel/tel_search.php">
<postfield name="city_id" value="010"></postfield>
<postfield name="tuid" value="22128034"></postfield>
<postfield name="sid" value=""></postfield>
<postfield name="tel" value="$tel"></postfield>
</go>
</anchor>
<br/>
手机号:1590058****<br/>
归属地:上海<br/>
卡类型:移动全球通卡<br/>
<a href="wtai://wp/mc;1590058****">直接拨打</a><br/>
<a href="wtai://wp/mc;179511590058****">加17951拨打</a><br/>
<a href="/opinion/list.php?city_id=010&tuid=22128034">查询结果不满意?</a><br/>
<br/>
<anchor>返回上页<prev/></anchor><br/>
<a href="/search/category.php?city_id=010&tuid=22128034&cate_name=%E7%BE%8E%E9%A3%9F&sid=">美食</a>
<a href="/search/category.php?city_id=010&tuid=22128034&cate_name=%E5%A8%B1%E4%B9%90&sid=">娱乐</a>
<a href="/search/category.php?city_id=010&tuid=22128034&cate_name=%E6%9C%8D%E5%8A%A1&sid=">服务</a>
<br/>
<a href="/index.php?city_id=010&tuid=22128034&sid=">乐活首页</a><br/>
乐活<br/>
09-22 14:52 </p>
</card></wml>