james邮件服务器问题 我用 页面修改了 james config.xml配置文件 只修改了其中的部分 但是 再去查看 整个 config.xml 都从新生成了 以前删除的内容 都又出来了我把注释 都删掉了 一开始 但是经过修改以后 又都回来了 郁闷!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 config.xml有界面进行操作吗?我都是一直接改config.xml进行配置的。 我写了 一个界面 用DOM4J 来操作他 也就修改下 链接数据库的 和 命名那里 的内容 但是 修改成功以后 就把 一些 去掉的内容复原了 你用dom4j操作完之后,没有重新生成新的文件吧?这你就要看看dom4j是怎么操作一个xml文件的。 看来 就是 这部分的问题XmlConfig xc = new XmlConfig(); xc.updateCallBoardInfo("James/postmaster", sname); xc.updateCallBoardInfo("pop3server/handler/helloName", sname); xc.updateCallBoardInfo("nntpserver/handler/helloName", sname); xc.updateCallBoardInfo("smtpserver/handler/helloName", sname); xc.updateCallBoardInfo("database-connections/data-source/dburl", sdba); xc.updateCallBoardInfo("database-connections/data-source/user", sdbu); xc.updateCallBoardInfo("database-connections/data-source/password", sdbp);这个是servlet 调用的 public static boolean updateCallBoardInfo(String node,String content){ xmlFile = new File(path1); reader = new SAXReader(); try { document = reader.read(xmlFile); } catch (DocumentException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } List list=document.selectNodes("config/"+node); Iterator it=list.iterator(); if (it.hasNext()) { Element ele=(Element)it.next(); ele.setText(content); } try { writer = new XMLWriter(new FileOutputStream(xmlFile)); writer.write(document); writer.close(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return false; } catch (FileNotFoundException e) { e.printStackTrace(); return false; } catch (IOException e) { e.printStackTrace(); return false; } return true; } if (it.hasNext()) { Element ele=(Element)it.next(); ele.setText(content); }这个地方应该是个循环吧?不能用if。for (Iterator iter = l.iterator(); iter.hasNext();) 这样才能把所有的节点给替换 换个写法试试看对了 还有个问题 我写了个 打开 james服务的 类 就是用 Process p =Runtime.getRuntime().exec("cmd.exe /c "+"start "+sRestartPath); 来调用他的run.bat但是 关闭 不知道怎么写 错了。我是把他加到系统服务里了。才是wrapper.exe. 发现一个关闭的好办法 用telnet shutdown james 能用连接池不 用过吗? JSP session失效问题 跪求ExtJs如何画曲线图 根据某年某月某周得到一个具体的时间范围! 请问,访问一个机子的IP就可以访问到tomcat下的项目 java 写文件 jsp程序问题 关于泛型。 JRUN4环境下调试文件应放在哪个目录下?谢谢! 关于jsp问题 poi读取word2007 docx表格 java小程序可以运行,但是actionPerformed()好像不起作用?帮忙看看谢谢 spring错误请高人解决
xc.updateCallBoardInfo("James/postmaster", sname);
xc.updateCallBoardInfo("pop3server/handler/helloName", sname);
xc.updateCallBoardInfo("nntpserver/handler/helloName", sname);
xc.updateCallBoardInfo("smtpserver/handler/helloName", sname);
xc.updateCallBoardInfo("database-connections/data-source/dburl", sdba);
xc.updateCallBoardInfo("database-connections/data-source/user", sdbu);
xc.updateCallBoardInfo("database-connections/data-source/password", sdbp);这个是servlet 调用的 public static boolean updateCallBoardInfo(String node,String content){
xmlFile = new File(path1);
reader = new SAXReader();
try {
document = reader.read(xmlFile);
} catch (DocumentException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
List list=document.selectNodes("config/"+node);
Iterator it=list.iterator();
if (it.hasNext()) {
Element ele=(Element)it.next();
ele.setText(content);
}
try {
writer = new XMLWriter(new FileOutputStream(xmlFile));
writer.write(document);
writer.close();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return false;
} catch (FileNotFoundException e) {
e.printStackTrace();
return false;
} catch (IOException e) {
e.printStackTrace();
return false;
}
return true;
}
Element ele=(Element)it.next();
ele.setText(content);
}
这个地方应该是个循环吧?不能用if。
for (Iterator iter = l.iterator(); iter.hasNext();)
这样才能把所有的节点给替换
对了 还有个问题 我写了个 打开 james服务的 类 就是用 Process p =Runtime.getRuntime().exec("cmd.exe /c "+"start "+sRestartPath); 来调用他的run.bat
但是 关闭 不知道怎么写