NetBeansIDE的介绍
青菜萝卜各有所爱,我一直使用的IDE开发工具是Netbeans。然而因为NetbeansIDE的使用者比较少。所以,在国内想要找到一些好的使用手册也比较少。
我尝试使用了MyEclipse,可是还是觉得Netbeans IDE是我更喜欢的开发工具,它支持很多功能,正好它网页上所显示的一样。说实在的,它非常像IntelliJ IDEA,功能也很强大。具体的介绍,请见 NetBeansIDE所有功能及支持的技术的中文介绍
NetBeans IDE 使您能够轻松快速地开发 Java 桌面、Mobile 和 Web 应用程序以及使用 HTML、JavaScript 和 CSS 的 HTML5 应用程序。IDE 还为 PHP 和 C/C++ 开发者提供一组强大的工具。它是免费和开源的,有一个由世界各地的用户和开发者组成的大社区。
最主要的是,它能支持HTML5、CSS3、javascript、PHP、JSP等代码提示。当然,它对JAVA代码也是支持的。我在Eclipse中怎么也找不到这个代码提示,特别的CSS Style的提示。
另外,像Eclipse一样的一些代码重构、排版、注释、getter,setter方法生成等等功能都具备。
DTD和XML方案配置
当使用Spring开发的时候,我们都会需要配置XML文件,例如编写完如下内容后,在写<bean> 时会有属性提示。 前提是Netbeans需要到Springframework.org去下载相关的 xsd文件。然而当IDE没有Internet连接或Springframework网站不可访问时,就没有属性提示。
Spring配置文件
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
在这里,NetBeans IDE提供了一个解决方案,你可以在本地存放XSD文件,配置一个目录解释的XML文件,添加到 DTD和XML方案里就可以了。下面,说一下具体方法:
先把Spring项目从网上下载,解压后得到schema目录,里面有各个xsd文件,存放到你指定的位置
然后编写一个XML文件, 就是SystemID 与 URI的对应条目的XML文件,如下:
catalog.xml文件内容<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="system"> <system systemId="http://www.springframework.org/schema/aop/spring-aop-3.0.xsd" uri="file:/D:/java/schema/www.springframework.org/schema/aop/spring-aop-3.0.xsd"/> <system systemId="http://www.springframework.org/schema/aop/spring-aop-3.1.xsd" uri="file:/D:/java/schema/www.springframework.org/schema/aop/spring-aop-3.1.xsd"/> <system systemId="http://www.springframework.org/schema/aop/spring-aop-3.2.xsd" uri="file:/D:/java/schema/www.springframework.org/schema/aop/spring-aop-3.2.xsd"/> <system systemId="http://www.springframework.org/schema/aop/spring-aop-4.0.xsd" uri="file:/D:/java/schema/www.springframework.org/schema/aop/spring-aop-4.0.xsd"/> <system systemId="http://www.springframework.org/schema/beans/spring-beans-2.0.xsd" uri="file:/D:/java/schema/www.springframework.org/schema/beans/spring-beans-2.0.xsd"/> <system systemId="http://www.springframework.org/schema/beans/spring-beans-2.5.xsd" uri="file:/D:/java/schema/www.springframework.org/schema/beans/spring-beans-2.5.xsd"/> <system systemId="http://www.springframework.org/schema/beans/spring-beans-3.0.xsd" uri="file:/D:/java/schema/www.springframework.org/schema/beans/spring-beans-3.0.xsd"/> <system systemId="http://www.springframework.org/schema/beans/spring-beans-3.1.xsd" uri="file:/D:/java/schema/www.springframework.org/schema/beans/spring-beans-3.1.xsd"/> <system systemId="http://www.springframework.org/schema/beans/spring-beans-3.2.xsd" uri="file:/D:/java/schema/www.springframework.org/schema/beans/spring-beans-3.2.xsd"/> <system systemId="http://www.springframework.org/schema/beans/spring-beans-4.0.xsd" uri="file:/D:/java/schema/www.springframework.org/schema/beans/spring-beans-4.0.xsd"/> <system systemId="http://www.springframework.org/schema/context/spring-context-3.0.xsd" uri="file:/D:/java/schema/www.springframework.org/schema/context/spring-context-3.0.xsd"/> <system systemId="http://www.springframework.org/schema/context/spring-context-3.1.xsd" uri="file:/D:/java/schema/www.springframework.org/schema/context/spring-context-3.1.xsd"/> <system systemId="http://www.springframework.org/schema/context/spring-context-3.2.xsd" uri="file:/D:/java/schema/www.springframework.org/schema/context/spring-context-3.2.xsd"/> ...................... ...................中间省略 <system systemId="http://www.springframework.org/schema/tx/spring-tx-4.0.xsd" uri="file:/D:/java/schema/www.springframework.org/schema/tx/spring-tx-4.0.xsd"/> </catalog>
前面两步的准备工作完成后,就是添加目录文件就可以了。点击菜单工具–>DTD和XML方案–>添加目录–>选取catalog.xml,确定。
最后看到多了一条就可以了,再去编辑你的Spring XML看看。虽然在输出窗口会得到错误提示,但是在bean配置中仍然可以得到提示。
错误: 未知的主机: www.springframework.org
URL 资源