﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-zhyiwww -随笔分类-discuss</title><link>http://www.blogjava.net/zhyiwww/category/16561.html</link><description>用平实的笔，记录编程路上的点点滴滴………</description><language>zh-cn</language><lastBuildDate>Sun, 09 Aug 2009 09:53:24 GMT</lastBuildDate><pubDate>Sun, 09 Aug 2009 09:53:24 GMT</pubDate><ttl>60</ttl><item><title>在postgis使用google 900913投影</title><link>http://www.blogjava.net/zhyiwww/archive/2009/02/19/255651.html</link><dc:creator>zhyiwww</dc:creator><author>zhyiwww</author><pubDate>Thu, 19 Feb 2009 13:36:00 GMT</pubDate><guid>http://www.blogjava.net/zhyiwww/archive/2009/02/19/255651.html</guid><wfw:comment>http://www.blogjava.net/zhyiwww/comments/255651.html</wfw:comment><comments>http://www.blogjava.net/zhyiwww/archive/2009/02/19/255651.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/zhyiwww/comments/commentRss/255651.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/zhyiwww/services/trackbacks/255651.html</trackback:ping><description><![CDATA[
		<br />在postgis中是使用google epsg:900913 投影<br />平台：debian<br />[1]编辑/opt/proj/share/proj/epsg文件<br /><font color="#0000ff"><i><font size="2"><b>注意：<br />我安装的proj在/opt/proj目录，所以，就编辑/opt/proj/share/proj/epsg文件<br />如果你用aptitude install proj，那么就编辑 /usr/share/proj/epsg文件</b></font></i></font><u><font color="#008000" size="2"><b><br /></b></font></u><br />在文件的结尾添加<br /><br /><font color="#006400" size="2"># Google Mercator<br />&lt;900913&gt; +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs &lt;&gt;<br /><br /><font color="#000000"><font size="3">［2］在postgis数据库里面，添加如下记录<br /><br />INSERT into spatial_ref_sys (srid, auth_name, auth_srid, srtext, proj4text) values (900913 ,'EPSG',900913,'GEOGCS["WGS 84", DATUM["World Geodetic System<br />1984", SPHEROID["WGS 84", 6378137.0, 298.257223563,AUTHORITY["EPSG","7030"]], AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], NIT["degree",0.017453292519943295], AXIS["Longitude", EAST], AXIS["Latitude", NORTH],AUTHORITY["EPSG","4326"]], PROJECTION["Mercator_1SP"],PARAMETER["semi_minor", 6378137.0],<br />PARAMETER["latitude_of_origin",0.0], PARAMETER["central_meridian", 0.0], PARAMETER["scale_factor",1.0], PARAMETER["false_easting", 0.0], PARAMETER["false_northing", 0.0],UNIT["m", 1.0], AXIS["x", EAST], AXIS["y", NORTH],AUTHORITY["EPSG","900913"]] |','+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m<br />+nadgrids=@null +no_defs'); <br /><br /><br /><br /></font></font><br /><br /><br /><br /></font><img src ="http://www.blogjava.net/zhyiwww/aggbug/255651.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/zhyiwww/" target="_blank">zhyiwww</a> 2009-02-19 21:36 <a href="http://www.blogjava.net/zhyiwww/archive/2009/02/19/255651.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>一段代码的疑问</title><link>http://www.blogjava.net/zhyiwww/archive/2006/10/27/77663.html</link><dc:creator>zhyiwww</dc:creator><author>zhyiwww</author><pubDate>Fri, 27 Oct 2006 07:43:00 GMT</pubDate><guid>http://www.blogjava.net/zhyiwww/archive/2006/10/27/77663.html</guid><wfw:comment>http://www.blogjava.net/zhyiwww/comments/77663.html</wfw:comment><comments>http://www.blogjava.net/zhyiwww/archive/2006/10/27/77663.html#Feedback</comments><slash:comments>8</slash:comments><wfw:commentRss>http://www.blogjava.net/zhyiwww/comments/commentRss/77663.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/zhyiwww/services/trackbacks/77663.html</trackback:ping><description><![CDATA[今天看源代码，看到了如下的一段：  <br />  public Object pop()<br />    {<br />        return stack.pop();<br /><strong><font color="#000080" size="4">        EmptyStackException e;<br />        e;</font></strong><br />        log.warn("Empty stack (returning null)");<br />        return null;<br />    }<br />   蓝色加粗的部分，我不太明白是什么意思，有shenm<br />什末作用，请看到此帖子的朋友给解释一下。<img src ="http://www.blogjava.net/zhyiwww/aggbug/77663.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/zhyiwww/" target="_blank">zhyiwww</a> 2006-10-27 15:43 <a href="http://www.blogjava.net/zhyiwww/archive/2006/10/27/77663.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>就读取Properties文件问题回复itVincent</title><link>http://www.blogjava.net/zhyiwww/archive/2006/10/24/77070.html</link><dc:creator>zhyiwww</dc:creator><author>zhyiwww</author><pubDate>Tue, 24 Oct 2006 13:03:00 GMT</pubDate><guid>http://www.blogjava.net/zhyiwww/archive/2006/10/24/77070.html</guid><wfw:comment>http://www.blogjava.net/zhyiwww/comments/77070.html</wfw:comment><comments>http://www.blogjava.net/zhyiwww/archive/2006/10/24/77070.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/zhyiwww/comments/commentRss/77070.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/zhyiwww/services/trackbacks/77070.html</trackback:ping><description><![CDATA[
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="FONT-FAMILY: Arial">itVincent ,</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: 楷体_GB2312">非常感谢您的回复<span lang="EN-US">.</span>看到您的回复<span lang="EN-US">,</span>我就作了一下测试<span lang="EN-US">.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /?><o:p></o:p></span></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<b style="mso-bidi-font-weight: normal">
						<span style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: 楷体_GB2312">我的测试代码如下<span lang="EN-US">:<o:p></o:p></span></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<span style="mso-tab-count: 2">              </span>
				</span>
				<span lang="EN-US" style="FONT-FAMILY: Arial">//InputStream in=LoginAction.class.getClassLoader().getResourceAsStream("com.yourcompany.struts.config.properties");<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial">
								<span style="mso-tab-count: 2">              </span>
								<span style="COLOR: blue">InputStream in=LoginAction.class.getClassLoader().getResourceAsStream("com//yourcompany//struts//config.properties");<o:p></o:p></span>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 2">              </span>
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 2">              </span>System.out.println("properties<span style="mso-spacerun: yes">  </span>in<span style="mso-spacerun: yes">  </span>is<span style="mso-spacerun: yes">  </span>:<span style="mso-spacerun: yes">   </span>"+in);<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 2">              </span>Properties<span style="mso-spacerun: yes">  </span>p=new Properties();<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 2">              </span>try {<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 3">                     </span>p.load(in);<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 3">                     </span>String h=p.getProperty("JAVA_HOME");<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 3">                     </span>System.out.println("JAVA_HOME<span style="mso-spacerun: yes">   </span>:<span style="mso-spacerun: yes">  </span>--<span style="mso-spacerun: yes">  </span>"+h);<span style="mso-tab-count: 1">   </span><o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 2">              </span>} catch (IOException e1) {<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 3">                     </span>e1.printStackTrace();<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 2">              </span>}<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="COLOR: fuchsia; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">我是在一个</span>
				<span lang="EN-US" style="COLOR: fuchsia">action</span>
				<span style="COLOR: fuchsia; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中写的这段代码</span>
				<span lang="EN-US" style="COLOR: fuchsia">.<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<b style="mso-bidi-font-weight: normal">
						<span style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: 楷体_GB2312">执行后的结果如下<span lang="EN-US">:</span>（错误）<span lang="EN-US"><o:p></o:p></span></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">properties<span style="mso-spacerun: yes">  </span>in<span style="mso-spacerun: yes">  </span>is<span style="mso-spacerun: yes">  </span>:<span style="mso-spacerun: yes">   </span>null<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">2006-10-24 20:36:59 org.apache.struts.action.RequestProcessor processExc<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">警告</span>
				<span lang="EN-US" style="FONT-FAMILY: Arial">: Unhandled Exception thrown: class java.lang.NullPointerException<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<b style="mso-bidi-font-weight: normal">
						<span style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: 楷体_GB2312">页面的错误是<span lang="EN-US">:<o:p></o:p></span></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">message <o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">description The server encountered an internal error () that prevented it from fulfilling this request.<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">exception <o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">javax.servlet.ServletException<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 1">       </span>org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:523)<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 1">       </span>org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 1">       </span>org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 1">       </span>org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 1">       </span>org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 1">       </span>javax.servlet.http.HttpServlet.service(HttpServlet.java:709)<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 1">       </span>javax.servlet.http.HttpServlet.service(HttpServlet.java:802)<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">root cause <o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">java.lang.NullPointerException<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 1">       </span>java.util.Properties$LineReader.readLine(Properties.java:365)<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 1">       </span>java.util.Properties.load(Properties.java:293)<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 1">       </span>com.yourcompany.struts.action.LoginAction.execute(LoginAction.java:134)<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 1">       </span>org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 1">       </span>org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 1">       </span>org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 1">       </span>org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 1">       </span>javax.servlet.http.HttpServlet.service(HttpServlet.java:709)<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 1">       </span>javax.servlet.http.HttpServlet.service(HttpServlet.java:802)<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">note The full stack trace of the root cause is available in the Apache Tomcat/<?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /?><st1:chsdate w:st="on" isrocdate="False" islunardate="False" day="30" month="12" year="1899">5.0.28</st1:chsdate> logs.<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<o:p> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<span style="mso-tab-count: 1">       </span>
				</span>
				<b style="mso-bidi-font-weight: normal">
						<span style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: 楷体_GB2312">然后我又作了如下的测试：<span lang="EN-US"><o:p></o:p></span></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: blue; FONT-FAMILY: Arial">
								<span style="mso-tab-count: 2">              </span>InputStream in1=LoginAction.class.getClassLoader().getResourceAsStream("config.properties");<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 2">              </span>
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 2">              </span>System.out.println("properties<span style="mso-spacerun: yes">  </span>in<span style="mso-spacerun: yes">  </span>is<span style="mso-spacerun: yes">  </span>:<span style="mso-spacerun: yes">   </span>"+in1);<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 2">              </span>Properties<span style="mso-spacerun: yes">  </span>p1=new Properties();<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 2">              </span>try {<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 3">                     </span>p1.load(in1);<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 3">                     </span>String h1=p1.getProperty("JAVA_HOME");<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 3">                     </span>System.out.println("JAVA_HOME<span style="mso-spacerun: yes">   </span>:<span style="mso-spacerun: yes">  </span>--<span style="mso-spacerun: yes">  </span>"+h1);<span style="mso-tab-count: 1"></span><o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 2">              </span>} catch (IOException e1) {<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 3">                     </span>// TODO Auto-generated catch block<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 3">                     </span>e1.printStackTrace();<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial">
						<span style="mso-tab-count: 2">              </span>}<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<b style="mso-bidi-font-weight: normal">
						<span style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: 楷体_GB2312">执行后的结果如下：（正确）<span lang="EN-US"><o:p></o:p></span></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">properties<span style="mso-spacerun: yes">  </span>in<span style="mso-spacerun: yes">  </span>is<span style="mso-spacerun: yes">  </span>:<span style="mso-spacerun: yes">   </span>java.io.ByteArrayInputStream@257b34<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">JAVA_HOME<span style="mso-spacerun: yes">   </span>:<span style="mso-spacerun: yes">  </span>--<span style="mso-spacerun: yes">  </span>c:jdk<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">xml file<span style="mso-spacerun: yes">  </span>url<span style="mso-spacerun: yes">  </span>is<span style="mso-spacerun: yes">  </span>:<span style="mso-spacerun: yes">  </span>file:/D:/jakarta-tomcat-<st1:chsdate w:st="on" isrocdate="False" islunardate="False" day="30" month="12" year="1899">5.0.28</st1:chsdate>/webapps/StrutsDemo/WEB-INF/<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">classes/config.xml<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">inputStream of the xml file<span style="mso-spacerun: yes">  </span>is<span style="mso-spacerun: yes">  </span>:<span style="mso-spacerun: yes">  </span>java.io.BufferedInputStream@ca5bff<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">reader<span style="mso-spacerun: yes">   </span>:<span style="mso-spacerun: yes">   </span>org.dom4j.io.SAXReader@1cd3dd7<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">document doc<span style="mso-spacerun: yes">  </span>is<span style="mso-spacerun: yes">  </span>:<span style="mso-spacerun: yes">  </span>org.dom4j.tree.DefaultDocument@<st1:chmetcnv w:st="on" tcsc="0" numbertype="1" negative="False" hasspace="False" sourcevalue="13" unitname="C">13c</st1:chmetcnv><st1:chmetcnv w:st="on" tcsc="0" numbertype="1" negative="False" hasspace="False" sourcevalue="4" unitname="C">4c</st1:chmetcnv>09 [Document: name null<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">]<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">action<span style="mso-spacerun: yes">  </span>document<span style="mso-spacerun: yes">  </span>is<span style="mso-spacerun: yes">  </span>:<span style="mso-spacerun: yes">  </span>org.dom4j.tree.DefaultDocument@<st1:chmetcnv w:st="on" tcsc="0" numbertype="1" negative="False" hasspace="False" sourcevalue="13" unitname="C">13c</st1:chmetcnv><st1:chmetcnv w:st="on" tcsc="0" numbertype="1" negative="False" hasspace="False" sourcevalue="4" unitname="C">4c</st1:chmetcnv>09 [Document: name<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">null]<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">note<span style="mso-spacerun: yes">  </span>List is : 1<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">java home<span style="mso-spacerun: yes">  </span>node<span style="mso-spacerun: yes">  </span>is<span style="mso-spacerun: yes">  </span>:<span style="mso-spacerun: yes">  </span>org.dom4j.tree.DefaultElement@f<st1:chmetcnv w:st="on" tcsc="0" numbertype="1" negative="False" hasspace="False" sourcevalue="1" unitname="F">1f</st1:chmetcnv><st1:chmetcnv w:st="on" tcsc="0" numbertype="1" negative="False" hasspace="False" sourcevalue="34" unitname="a">34a</st1:chmetcnv> [Element: &lt;java att<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">ributes: []/&gt;]<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-FAMILY: Arial; mso-bidi-font-size: 10.5pt">the value of the java node<span style="mso-spacerun: yes">  </span>is<span style="mso-spacerun: yes">  </span>:<span style="mso-spacerun: yes">  </span>c:\jdk<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="FONT-SIZE: 12pt; FONT-FAMILY: Arial">
								<o:p> </o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<b style="mso-bidi-font-weight: normal">
						<span style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">两次的结果不同点的分析：</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: Arial">
								<o:p>
								</o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: Arial">
								<span style="mso-tab-count: 1">       </span>
						</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span style="FONT-SIZE: 12pt; COLOR: fuchsia; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">（主要看蓝色的代码部分，文件的存放位置的不同）</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: fuchsia; FONT-FAMILY: Arial">
								<o:p>
								</o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: Arial">
								<span style="mso-tab-count: 1">       </span>
						</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">第一种方法，配置文件在</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: Arial">WEB-INF/classes/</span>
				</b>
				<span lang="EN-US">
				</span>
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: Arial">com/yourcompany/struts/config.properties</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">目录下放着。也就是在包目录下。</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: Arial">
								<o:p>
								</o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: Arial">
								<span style="mso-tab-count: 1">       </span>
						</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">第二种方法，配置文件在</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: Arial">WEB-INF/classes/</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">目录下存放。也就是根目录下。</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: Arial">
								<o:p>
								</o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: Arial">
								<span style="mso-tab-count: 1">       </span>
						</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">所以如果用第二种方法来读第一种配置文件，就会出错。</span>
				</b>
				<b style="mso-bidi-font-weight: normal">
						<span lang="EN-US" style="FONT-SIZE: 12pt; COLOR: green; FONT-FAMILY: Arial">
								<o:p>
								</o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US">
						<o:p> <br />--------------------------------------------------------------------------------------------------------------<br />以上是我的个人见解,欢迎批评指正<a href="mailto:.zhyiwww@163.com">.zhyiwww@163.com</a></o:p>
				</span>
		</p>
<img src ="http://www.blogjava.net/zhyiwww/aggbug/77070.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/zhyiwww/" target="_blank">zhyiwww</a> 2006-10-24 21:03 <a href="http://www.blogjava.net/zhyiwww/archive/2006/10/24/77070.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>