文章分类 -  Java学习笔记

Java学习笔记-本人学习Java过程的积累
摘要:HashMap,LinkedHashMap,TreeMap都属于Map Map 主要用于存储键(key)值(value)对,根据键得到值,因此键不允许键重复,但允许值重复。 HashMap 是一个最常用的Map,它根据键的HashCode 值存储数据,根据键可以直接获取它的值,具有很快的访问速度。HashMap最多只允许一条记录的键为Null;允许多条记录的值为Null;HashMap不支持线程的... 阅读全文
posted @ 2008-12-02 16:17 魔豆 阅读(9011) 评论(0) 推荐(1)
摘要:一、获取jamon jamon官方地址:http://jamonapi.sourceforge.net/ jamon下载地址:http://sourceforge.net/project/showfiles.php?group_id=96550 二、部署jamon到项目中 解压下载的压缩包,压缩包里有一个例子jamon.war,在项目里新建一个文件夹jamon,该文件夹跟WEB-INF同级,把例子... 阅读全文
posted @ 2008-11-20 23:59 魔豆 阅读(2002) 评论(0) 推荐(0)
摘要:1.第一个例子:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->2.第二个例子:Code highlighting produced by Actipr... 阅读全文
posted @ 2008-11-04 21:53 魔豆 阅读(24515) 评论(1) 推荐(2)
摘要:1.往数据库插入图片 数据库操作: Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> public void setImgByte(final byte[] bytes, final int id) { this.getJdb... 阅读全文
posted @ 2008-11-04 21:29 魔豆 阅读(1734) 评论(0) 推荐(0)
摘要:一、获取EHCache 下载地址:http://ehcache.sourceforge.net/ 二、使用EHCache 添加对应的jar包到classpath中:我使用的是1.5,需要添加ehcache-1.5.0.jar,backport-util-concurrent-3.0.jar,commons-logging-1.0.4.jar(这个包struts2中有,我没有添加) 在src目录建立... 阅读全文
posted @ 2008-11-03 20:26 魔豆 阅读(3229) 评论(0) 推荐(0)
摘要:1.准备工作 需要下载两个jar包:commons-httpclient和commons-codes commons-httpclient下载地址:http://hc.apache.org/downloads.cgi 4.0版的现在还没有正式版,我下的是3.1版的 commons-codes下载地址 阅读全文
posted @ 2008-11-03 15:46 魔豆 阅读(17638) 评论(0) 推荐(1)
摘要:为了方便初学者使用Struts2,我在附件放了一个配置好的Struts2空项目,可以直接使用Struts2,IDE使用的是MyEclipse6.5 使用方法: 1.在包com.test.web.action添加类,比如Test1Action.java,该类需要继承ActionSupport 2.在WebRoot/WEB-INF/jsp添加对应的页面Test1.jsp,把Test1Action类名的... 阅读全文
posted @ 2008-11-03 10:20 魔豆 阅读(466) 评论(0) 推荐(0)
摘要:1.下载 ActiveMQ 5.1.0 下载地址:http://activemq.apache.org/download.html 2.启动服务 把下载到的文件解压缩,比如c:\activemq,执行批处理文件c:\activemq\bin\activemq.bat 启动服务 3.测试 打开两个命令窗口,都进入c:\activemq\example,一个运行:ant consumer,一个... 阅读全文
posted @ 2008-10-24 13:59 魔豆 阅读(1561) 评论(0) 推荐(0)
摘要:本方法针对MyEclipse6.x版本有效 我的MyEclipse安装在C:\Program Files\MyEclipse 6.5 关闭MyEclipse,找到文件夹C:\Program Files\MyEclipse 6.5\eclipse\configuration\org.eclipse.update\ 把last.config.stamp文件删掉,启动MyEclipse,Update P... 阅读全文
posted @ 2008-10-23 10:14 魔豆 阅读(6274) 评论(0) 推荐(0)
摘要:下面的代码把数组的内容以“,”分隔,组合到一个字符串中: Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> public static void main(String[] args) { String[] obj = {"aa"... 阅读全文
posted @ 2008-10-21 14:16 魔豆 阅读(812) 评论(0) 推荐(0)
摘要:做的项目,在tomcat下跑没有问题,可是以war包的形式发布到weblogic上就出错了,getRealPath方法找不到路径: Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->String xmlFilePath = ServletActionC... 阅读全文
posted @ 2008-10-20 14:02 魔豆 阅读(1128) 评论(0) 推荐(0)
摘要:1. File->New->Applet Superclass使用javax.swing.JApplet,Options勾选 init() and destroy() ,进入下一步 Code Base改为applets/,FilePath选到Web根目录即可,完成 2.修改建立的Applet类文件的init事件: Code highlighting produced by Actipro C... 阅读全文
posted @ 2008-10-15 19:52 魔豆 阅读(794) 评论(0) 推荐(0)
摘要:Struts2的值是保存在ValueStack中的,假设有一个字符串str,我们一般是这么取值的: 或者 ${str} 如果想在jsp中使用的话,可以这么取: Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->…… 也可以把ValueStac... 阅读全文
posted @ 2008-10-14 18:53 魔豆 阅读(390) 评论(0) 推荐(0)
摘要:我是通过菜单MyEclipse->Project Capabilities添加了对Hibernate的支持 添加容易,删除难,菜单里好像没有删除对Hibernate支持的功能,只能手工删除了: 1.把项目根目录下文件.myhibernatedata删除 2.修改项目根目录下文件.project:删除其中两段内容: Code highlighting produced by Actipro Cod... 阅读全文
posted @ 2008-10-09 20:01 魔豆 阅读(783) 评论(0) 推荐(0)
摘要:开发过程中,我对struts2的s:component标签情有独钟,对于需要重复构建的内容,使用s:component是一个很好的解决办法。 s:component默认是使用freemarker模板方式处理 我用的IDE是MyEclipse6.5,使用的是默认的GBK编码:可以在这里查看:Window->Preferences->Workspace->Text file encoding stru... 阅读全文
posted @ 2008-10-09 18:44 魔豆 阅读(2730) 评论(0) 推荐(0)
摘要:先添加一个bean: Test1.java Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->package test;public class Test1 { private String str; public String getSt... 阅读全文
posted @ 2008-10-08 11:49 魔豆 阅读(4195) 评论(0) 推荐(0)
摘要:1.访问页面请求的参数 ${request.getParameter(name)} 或 ${name}:${request.getParameter(name)} 2.访问Session的内容 ${Session[name]} 3.获取struts2中s:component传递的参数的内容 ${parameters.name} 4.访问struts2中viewStack的内容 ${st... 阅读全文
posted @ 2008-10-08 11:43 魔豆 阅读(836) 评论(0) 推荐(0)
摘要:1.生成0~9之间的随机数 Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> public static void main(String[] args) { Random rnd = new Random(); S... 阅读全文
posted @ 2008-10-08 10:35 魔豆 阅读(3764) 评论(0) 推荐(0)
摘要:或者 阅读全文
posted @ 2008-10-06 13:38 魔豆 阅读(676) 评论(0) 推荐(0)
摘要:第一个例子:动态的加载一个页面到div中 test1.jsp Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> test2.jsp Code highlighting produced by Actipro CodeHighlighter (fr... 阅读全文
posted @ 2008-10-04 17:33 魔豆 阅读(1694) 评论(0) 推荐(0)