eclipse 技巧、问题及解决

来源:互联网 发布:淘宝店招牌设计 编辑:程序博客网 时间:2024/06/06 17:53
  • 启动eclipse 时出错,problems during startup .check the '.log' file in the “.metadata“ directioty of you workspace.往往需要重装jre才能解决
  • eclipse工程不能浏览,tomcat 不认这个虚拟目录,原因:工程中没有加入servlet-api.jar文件
  • tomcat ->conf->lib目录下加tools.jar文件
  • 在server.xml文件中没有的工程,tomcat还能浏览,tomcat->conf->catalina->localhost下还留有一手
  • beanutils.copyProperties 是按照bean里的属性名来拷贝的,所以一定注意属性名相同但是类型不同就会出现argument type mismatch copy properties错误
  • 使用hibernate时出现het.sf.hibernate.MappingException No persister for ,可能原因:只有一个id的entity,hbm.xml文件,cfg.xml 文件,看hbm.xml 文件名是否已写上,对于one-to-many(parent-to-child),应该用child.setparent(parent),而不是child.setParent(parent.id),自己的问题在于没有找到映射文件,如果在ant 中的build hibernate 项中有<copy  to dir=“{build}“ fileset dir=“{generated}“/></copy>,按理说eclipse会自动把hibernate文件生成到classes的entity目录下,如果entity目录下没有生成映射文件,请检查是否把generated目录设置为了src目录
  • 不能调试jsp文件的原因:work目录不是src目录
  • 不能调试功能原因:preference->tomcat->source path,你做调试的工程没打勾
  • 如果forword的路径是动态的,可以在Action中用new ActionForword的方法,而不用在struts-config.xml文件中配置。
  • 为何不用entity代替DTO?1.hibernate中entity中带有连接,如果把entity传到界面,会出现连接不释放 2.entity中包装的是简单对象,DTO中可以包装成复杂类型对象
  • java中执行cmd shell脚本:Runtime.getRuntime().exec(“cmd.exe /c copy c://a.exe c://b.exe“)