2007年12月18日
#
原文如下:
1. 写入文件的格式
写入 Xml 文件的时候默认是全部内容写为一行,这个可以通过加入 Format 来解决:
OutputFormat format = OutputFormat.createPrettyPrint();
2. Xml 中文问题
2.1 Xml 最好设为 UTF-8 格式,
format.setEncoding("utf-8");
2.2 不要用 FileWriter 输出双字节,改为 FileOutputStream 输出单字节:
XMLWriter output = new XMLWriter(new FileOutputStream(configFile), format);
3. CDATA类型文本输入
Element conTblOpr = rowElement.addElement(XmlDBConstants.CON_TBL_OPR);// 加入节点
DefaultCDATA conTblOprCdata = new DefaultCDATA(conTblOprField);// CDATA格式化
conTblOpr.add(conTblOprCdata );// 加入CDATA文本
Dom4j 里面已经内置了对 CDATA 类型文本的支持,不要硬编码去在文本两边加<![CDATA[***]]>。
用sun的ftp包连接IBM aix服务器抛如下错误:
501 port not allow after EPSV ALL, active mode off
原因:
ftp要改为被动passtive模式.
解决方法:
使用第三方包edtftpj-1.5.1.jar连接服务器,在连接前设置模式为passtive
Demo
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
package app4;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2006</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
import com.enterprisedt.net.ftp.FTPClient;
import com.enterprisedt.net.ftp.FTPMessageCollector;
import com.enterprisedt.net.ftp.FTPTransferType;
import com.enterprisedt.net.ftp.FTPConnectMode;
import com.enterprisedt.util.debug.Level;
import com.enterprisedt.util.debug.Logger;
import java.util.Date;
import java.io.File;
public class Demo {
/**
* Log stream
*/
private static Logger log = Logger.getLogger(Demo.class);
public static void main(String[] args) {
// we want remote host, user name and password
// if (args.length < 3) {
// usage();
// System.exit(1);
// }
// assign args to make it clear
String host = "localhost";//args[0];
String user = "lijun2";//args[1];
String password = "836301";//args[2];
Logger.setLevel(Level.ALL);
FTPClient ftp = null;
try {
// set up client
log.info("Connecting");
// get directory and print it to console
log.debug("Directory before put:");
String[] files =
ftp.dir(".", true);
for (int i = 0; i < files.length; i++)
log.debug(files[i]);
// copy file to server
System.out.println(new Date());
log.info("Putting file");
File loadfile = new File("a.ISO");
ftp.put("a.ISO", "a.ISO");
System.out.println(new Date());
// get directory and print it to console
log.debug("Directory after put");
files =
ftp.dir(".", true);
for (int i = 0; i < files.length; i++)
log.debug(files[i]);
// copy file from server
// log.info("Getting file");
//
ftp.get("2005.doc" + ".copy", "2005.doc");
// get directory and print it to console
// log.debug("Directory after delete");
files =
ftp.dir("", true);
for (int i = 0; i < files.length; i++)
log.debug(files[i]);
// Shut down client
log.info("Quitting client");
ftp.quit();
String messages = listener.getLog();
log.debug("Listener log:");
log.debug(messages);
log.info("Test complete");
} catch (Exception e) {
e.printStackTrace();
}
}
public static void usage() {
System.out.println("Usage: Demo remotehost user password");
}
}
Bug描述: SELECT elements ignore Z-index ("windowed element" problem)
连接:http://www.throbs.net/web/articles/IE-SELECT-bugs/#ieZIndex
问题原因:
1. select html标记在IE6下的解析不管Z-index
2. div 不能遮盖select,
解决思路:
1. 在select上用iframe遮盖
2. 在iframe上用div遮盖
3. iframe的width,height,top,left与div一样大.
示例代码
#zindexDiv{
position:absolute;
z-index:50;
width:expression(this.nextSibling.offsetWidth);
height:expression(this.nextSibling.offsetHeight);
top:expression(this.nextSibling.offsetTop);
left:expression(this.nextSibling.offsetLeft);
/*background-color:green;?ff????????,????????????????*/
}
#divUp{
z-index:99;
position:absolute;
background-color:red;
width:100;
height:18;
overflow:hidden;
height:60px;
}
#ddlTest{
width:200;
z-index:1;
}
</style>
<body>
<iframe id="zindexDiv" frameborder="0"></iframe>
<div id="divUp">aaaaaaa<br>bbbbbbb<br>ccccccc</div>
eclipse 3.2.2 下载地址:http://archive.eclipse.org/eclipse/downloads/drops/R-3.2.2-200702121330/download.php?dropFile=eclipse-SDK-3.2.2-win32.zip
MyEclipse Enterprise Workbench 5.5.1 GA for Windows 98/2000/NT/XP/Vista (05/21/2007) 下载地址:http://www.myeclipseide.com/Downloads-index-req-getit-lid-83.html
Maven 2.0.8 下载地址:
http://apache.mirror.phpchina.com/maven/binaries/apache-maven-2.0.8-bin.zip
Maven2的Eclipse插件:
http://m2eclipse.codehaus.orgupdate
Eclipse插件教程视频
http://m2eclipse.codehaus.org/Maven_2.0_Plugin_for_Eclipse.swf
mirror镜象网址
<repositories>
<repository>
<id>central</id>
<name>Internal Repository</name>
<url>http://mirrors.redv.com/maven2</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>Internal Repository</name>
<url>http://mirrors.redv.com/maven2</url>
</pluginRepository>
</pluginRepositories>
IE6下用
style="page-break-before: always"
可以打印分页.
IE7下不行.这句css不起作用
需要加上这句css
<!--[if IE 7]><br style="height:0; line-height:0"><![endif]-->
全部的css
<div style="page-break-before: always;">
<!--[if IE 7]><br style="height:0; line-height:0"><![endif]-->
</div>
可能会遇到“java.io.IOException: Server returned HTTP response code: 403 for URL”的错误信息。
通常是因为服务器的安全设置不接受Java程序作为客户端访问,解决方案是设置客户端的User Agent
将
URL httpUrl = new URL(rssURL);
改为
URLConnection con = new URL(url).openConnection();
con.setRequestProperty("User-Agent","Mozilla/4.0 (compatible; MSIE 5.0; Windows XP; DigExt)");