用java开发校内网小工具 (六)
今天完成群帖子的回复,已经是纯体力劳动了,和发帖没有什么区别,只不过是群帖子的地址要长一些
下面列出回复群帖子的核心代码:
[code]public void setReplyGroupBlog(String url,String strBody,String strAk) throws HttpException, IOException
{
try{
String[] groupInfo = new String[2];
groupInfo = ldFilter.getGroupBlogInfo(url);
String id=groupInfo[0];
String strTribeId = groupInfo[1];
System.out.println("群帖子的id是:"+id);
System.out.println("群帖子的TribeId是:"+strTribeId);
PostMethod post = new PostMethod ("http://group.xiaonei.com/ReplyPost.do?thread="+id);
StringPart body = new StringPart("body",strBody);
body.setCharSet("utf-8");
StringPart ak = new StringPart("ak",strAk);
StringPart tribeId = new StringPart("tribeId",strTribeId);
StringPart[] parts = {body,ak,tribeId};
post.setRequestEntity(new MultipartRequestEntity(parts,post.getParams()));
httpClient.executeMethod(post);
post.releaseConnection();
}
catch(Exception e)
{
System.out.println("回复群的帖子失败");
e.printStackTrace();
}
}[/code]
界面入下图
[size=3][color=#0000FF]1.回复贴准备页面,这里我用了html语句,回复的代码可以打出漂亮的蓝色阴影字,嘿嘿,看了就知道了:) [/color][/size]
[img][attach]15[/attach][/img]
[size=3][color=#0000FF]这个发彩字的代码如下: [/color][/size]
[code]<div style="FONT-SIZE: 30pt; FILTER: shadow(color=#87CEFA, strength=50); WIDTH: 499px; HEIGHT: 89px"><FONT face=隶书 color=#1e90ff>
<CENTER><B>欢迎访问海蓝博客!</B></FONT></CENTER></div>[/code]
[size=3][color=#0000FF]2.回复帖子成功页面[/color][/size]
[img][attach]16[/attach][/img]
[size=3][color=#0000FF]3.页面显示效果页面,挺漂亮的吧:) [/color][/size]
[img][attach]17[/attach][/img]
[p align=center][size=4] [color=#0000FF]海蓝原创,如需转载请注明转载地址[/color] [/size][/p]