﻿<?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-小猫Blog</title><link>http://www.blogjava.net/tomblog/</link><description>经验和技术的冲击</description><language>zh-cn</language><lastBuildDate>Thu, 23 Apr 2026 22:58:41 GMT</lastBuildDate><pubDate>Thu, 23 Apr 2026 22:58:41 GMT</pubDate><ttl>60</ttl><item><title>图解利用Eclipse3+Lomboz3+Tomcat开发JSP</title><link>http://www.blogjava.net/tomblog/archive/2005/09/16/13161.html</link><dc:creator>小猫Blog</dc:creator><author>小猫Blog</author><pubDate>Fri, 16 Sep 2005 08:06:00 GMT</pubDate><guid>http://www.blogjava.net/tomblog/archive/2005/09/16/13161.html</guid><wfw:comment>http://www.blogjava.net/tomblog/comments/13161.html</wfw:comment><comments>http://www.blogjava.net/tomblog/archive/2005/09/16/13161.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/tomblog/comments/commentRss/13161.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tomblog/services/trackbacks/13161.html</trackback:ping><description><![CDATA[<TABLE cellSpacing=0 cellPadding=0 width=776 border=0>
<TBODY>
<TR>
<TD width=1 bgColor=#b9bebe rowSpan=13></TD>
<TD vAlign=top width=603 bgColor=#f0f2fb>
<TABLE cellSpacing=0 cellPadding=0 width=603 border=0>
<TBODY>
<TR>
<TD width=10></TD>
<TD width=55>您的位置:</TD>
<TD width=538><A href="http://www.kissjava.com/index.html"><FONT color=#000000>爪哇流氓</FONT></A> / <A href="http://www.kissjava.com/doc/index.html"><FONT color=#000000>文档</FONT></A> / <A href="http://www.kissjava.com/doc/ev_tools/index.html"><FONT color=#000000>环境工具</FONT></A> / <A href="http://www.kissjava.com/doc/ev_tools/tools/index.html"><FONT color=#000000>工具使用</FONT></A> </TD></TR>
<TR></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=603 border=0>
<TBODY>
<TR>
<TD bgColor=#dee2f5 height=40>
<TABLE height=40 cellSpacing=0 cellPadding=0 width=590 align=center border=0>
<TBODY>
<TR>
<TD align=middle><FONT class=f22 color=#212121 size=5><B>图解利用Eclipse3+Lomboz3+Tomcat开发JSP</B></FONT></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD background=http://www.kissjava.com/skin/bluewhite/newhard-040906_c_1.gif height=1><FONT color=#212121 size=5></FONT></TD></TR>
<TR>
<TD vAlign=top height=5><FONT color=#212121 size=5></FONT></TD></TR>
<TR>
<TD>
<TABLE cellSpacing=0 cellPadding=0 width=603 border=0>
<TBODY>
<TR>
<TD vAlign=top align=middle width=340 rowSpan=9>
<TABLE cellSpacing=0 cellPadding=0 width=340 align=left border=0>
<TBODY>
<TR>
<TD width=5><FONT color=#212121 size=5></FONT></TD>
<TD align=left>
<SCRIPT language=JavaScript src="http://www.kissjava.com/ads/adx.js" type=text/javascript></SCRIPT>

<SCRIPT language=JavaScript type=text/javascript>
<!--
   if (!document.phpAds_used) document.phpAds_used = ',';
   phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);
   
   document.write ("<" + "script language='JavaScript' type='text/javascript' src='");
   document.write ("http://www.kissjava.com/ads/adjs.php?n=" + phpAds_random);
   document.write ("&amp;what=zone:4");
   document.write ("&amp;exclude=" + document.phpAds_used);
   if (document.referrer)
      document.write ("&amp;referer=" + escape(document.referrer));
   document.write ("'><" + "/script>");
//-->
</SCRIPT>

<SCRIPT language=JavaScript src="http://www.kissjava.com/ads/adjs.php?n=426018016&amp;what=zone:4&amp;exclude=," type=text/javascript></SCRIPT>

<SCRIPT type=text/javascript><!--
google_ad_client = "pub-2858891976876943";
google_ad_width = 336;
google_ad_height = 280;
google_ad_format = "336x280_as";
google_ad_channel ="";
google_color_border = "f0f2fb";
google_color_bg = "f0f2fb";
google_color_link = "0000CC";
google_color_url = "008000";
google_color_text = "000000";
//--></SCRIPT>

<SCRIPT src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type=text/javascript>
</SCRIPT>

<DIV id=beacon_5 style="LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px"><FONT color=#212121 size=5><IMG style="WIDTH: 0px; HEIGHT: 0px" height=0 alt="" src="http://www.kissjava.com/ads/adlog.php?bannerid=5&amp;clientid=2&amp;zoneid=4&amp;source=&amp;block=0&amp;capping=0&amp;cb=daba466d221ef756e77488ff566b9aff" width=0></FONT></DIV><IFRAME name=google_ads_frame marginWidth=0 marginHeight=0 src="http://pagead2.googlesyndication.com/pagead/ads?client=ca-pub-2858891976876943&amp;dt=1126857914718&amp;lmt=1125329080&amp;format=336x280_as&amp;output=html&amp;url=http%3A%2F%2Fwww.kissjava.com%2Fdoc%2Fev_tools%2Ftools%2F2005-06-05%2F15621117982185.html&amp;color_bg=f0f2fb&amp;color_text=000000&amp;color_link=0000CC&amp;color_url=008000&amp;color_border=f0f2fb&amp;cc=351&amp;u_h=768&amp;u_w=1024&amp;u_ah=740&amp;u_aw=1024&amp;u_cd=32&amp;u_tz=480&amp;u_java=true" frameBorder=0 width=336 scrolling=no height=280 allowTransparency><img height="1" width="1" border="0" src="http://pagead2.googlesyndication.com/pagead/imp.gif?event=noiframe&client=ca-pub-2858891976876943&dt=1126857914718&lmt=1125329080&format=336x280_as&output=html&url=http%3A%2F%2Fwww.kissjava.com%2Fdoc%2Fev_tools%2Ftools%2F2005-06-05%2F15621117982185.html&color_bg=f0f2fb&color_text=000000&color_link=0000CC&color_url=008000&color_border=f0f2fb&cc=351&u_h=768&u_w=1024&u_ah=740&u_aw=1024&u_cd=32&u_tz=480&u_java=true" /></IFRAME><FONT size=5><NOSCRIPT><a href='http://www.kissjava.com/ads/adclick.php?n=ac9d5620' target='_blank'><img src='http://www.kissjava.com/ads/adview.php?what=zone:4&n=ac9d5620' border='0' alt=''></a></NOSCRIPT><FONT color=#212121></FONT></FONT></TD></TR>
<TR>
<TD align=middle><FONT color=#212121 size=5></FONT></TD>
<TD align=middle><FONT color=#212121 size=5></FONT></TD></TR></TBODY></TABLE></TD>
<TD width=5><FONT color=#212121 size=5></FONT></TD>
<TD vAlign=top width=253>
<TABLE cellSpacing=0 cellPadding=0 width=250 border=0>
<TBODY>
<TR>
<TD colSpan=2><FONT class=f21 color=#0e3e92 size=2><B>[文章信息]</B></FONT></TD></TR>
<TR>
<TD colSpan=2 height=10><FONT color=#0e3e92 size=2></FONT></TD></TR>
<TR>
<TD vAlign=top width=62>作者:</TD>
<TD vAlign=top width=158><FONT color=#0e3e92>javamxj</FONT></TD></TR>
<TR>
<TD vAlign=top>时间:</TD>
<TD vAlign=top><FONT color=#0e3e92>2005-06-05 22:33:21</FONT></TD></TR>
<TR>
<TD vAlign=top>出处:</TD>
<TD vAlign=top><FONT color=#0e3e92>KissJava.com</FONT></TD></TR>
<TR>
<TD vAlign=top>责任编辑:</TD>
<TD vAlign=top><FONT color=#0e3e92>Prose</FONT></TD></TR>
<TR>
<TD vAlign=top>点击:</TD>
<TD vAlign=top>
<SCRIPT src="http://www.kissjava.com/_cmsware/publish/counter.php?IndexID=1562"></SCRIPT>

<SCRIPT src="http://www.kissjava.com/_cmsware/publish/counter.php?o=display&amp;Id=1562"></SCRIPT>
5400</TD></TR>
<TR>
<TD colSpan=2 height=10></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=250 border=0>
<TBODY>
<TR>
<TD colSpan=2><FONT class=f21 color=#0e3e92 size=2><B>[文章导读]</B></FONT></TD></TR>
<TR>
<TD colSpan=2 height=10><FONT color=#0e3e92 size=2></FONT></TD></TR>
<TR>
<TD vAlign=top colSpan=2><SPAN class=f14>我最近看了不少有关Lomboz的资料，发现有不少网友都对这个eclipse插件感兴趣，但苦于入门。感觉有必要把自己学习Lomboz的心得写下来，以便后来人不至于走太多的弯路</SPAN></TD></TR>
<TR>
<TD colSpan=2 height=10></TD></TR></TBODY></TABLE></TD>
<TD width=5></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD>
<TD width=1 bgColor=#b9bebe rowSpan=13></TD>
<TD vAlign=top align=middle width=170 bgColor=#ffffff rowSpan=13>
<TABLE cellSpacing=5 cellPadding=0 width=165 border=0>
<TBODY>
<TR>
<TD align=middle></TD></TR></TBODY></TABLE>
<TABLE height=28 cellSpacing=0 cellPadding=0 width=160 background=http://www.kissjava.com/skin/bluewhite/2004-30.gif border=0>
<TBODY>
<TR>
<TD align=middle><B>专题推荐</B></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=160 border=0>
<TBODY>
<TR>
<TD width=1 bgColor=#adadad></TD>
<TD bgColor=#ffffff>· <A href="http://www.kissjava.com/zhuanti/mobilephone/index.html" target=_blank><FONT color=#000000>手机游戏开发专辑</FONT></A><BR>· <A href="http://www.kissjava.com/zhuanti/struts/index.html" target=_blank><FONT color=#000000>Struts专题学习</FONT></A><BR>· <A href="http://www.kissjava.com/zhuanti/hibernate/index.html" target=_blank><FONT color=#000000>Hibernate大杂烩</FONT></A><BR>· <A href="http://www.kissjava.com/zhuanti/webwork/index.html" target=_blank><FONT color=#000000>WebWork全接触</FONT></A><BR>· <A href="http://www.kissjava.com/zhuanti/spring/index.html" target=_blank><FONT color=#000000>Spring - 春的诱惑</FONT></A><BR>· <A href="http://www.kissjava.com/zhuanti/eclipse/index.html" target=_blank><FONT color=#000000>Eclipse使用大全</FONT></A><BR>· <A href="http://www.kissjava.com/zhuanti/jbuilder/index.html" target=_blank><FONT color=#000000>JBuilder 开发者指南</FONT></A><BR>· <A href="http://www.kissjava.com/zhuanti/ant/index.html" target=_blank><FONT color=#000000>Ant - 让编程更轻松</FONT></A><BR></TD>
<TD width=1 bgColor=#adadad></TD></TR></TBODY></TABLE>
<TABLE height=1 cellSpacing=0 cellPadding=0 width=160 bgColor=#adadad border=0>
<TBODY>
<TR>
<TD></TD></TR></TBODY></TABLE>
<TABLE height=10 cellSpacing=0 cellPadding=0 width=160 border=0>
<TBODY>
<TR>
<TD></TD></TR></TBODY></TABLE>
<TABLE height=28 cellSpacing=0 cellPadding=0 width=160 background=http://www.kissjava.com/skin/bluewhite/2004-30.gif border=0>
<TBODY>
<TR>
<TD align=middle><B>热门文章</B></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=160 border=0>
<TBODY>
<TR>
<TD width=1 bgColor=#adadad></TD>
<TD align=middle bgColor=#ffffff>
<TABLE cellSpacing=0 cellPadding=2 width=150 border=0>
<TBODY>
<TR>
<TD width=7>· </TD>
<TD width=143><A href="http://www.kissjava.com/doc/ev_tools/tools/2005-06-05/15621117982185.html" target=_blank><FONT color=#000000>图解利用Eclipse3+Lomboz3+Tomcat开发JSP</FONT></A>(<FONT color=#ff6600>4673</FONT>)</TD></TR>
<TR>
<TD width=7>· </TD>
<TD width=143><A href="http://www.kissjava.com/doc/ev_tools/tools/2005-06-05/15621117982185.html" target=_blank><FONT color=#000000>图解利用Eclipse3+Lomboz3+Tomcat开发JSP</FONT></A>(<FONT color=#ff6600>4673</FONT>)</TD></TR>
<TR>
<TD width=7>· </TD>
<TD width=143><A href="http://www.kissjava.com/doc/j2ee/webservice/2005-05-09/2561115628598.html" target=_blank><FONT color=#000000>史上最简单的struts+spring+hibernate配置实例</FONT></A>(<FONT color=#ff6600>4657</FONT>)</TD></TR>
<TR>
<TD width=7>· </TD>
<TD width=143><A href="http://www.kissjava.com/doc/ev_tools/tools/2005-06-02/12081117691499.html" target=_blank><FONT color=#000000>Eclipse 平台Java开发入门</FONT></A>(<FONT color=#ff6600>4568</FONT>)</TD></TR>
<TR>
<TD width=7>· </TD>
<TD width=143><A href="http://www.kissjava.com/doc/ev_tools/tools/2005-06-02/12081117691499.html" target=_blank><FONT color=#000000>Eclipse 平台Java开发入门</FONT></A>(<FONT color=#ff6600>4568</FONT>)</TD></TR>
<TR>
<TD width=7>· </TD>
<TD width=143><A href="http://www.kissjava.com/onestep/2005-04-30/2361114826788.html" target=_blank><FONT color=#000000>Spring&nbsp;入门(一个简单的例子)</FONT></A>(<FONT color=#ff6600>3349</FONT>)</TD></TR>
<TR>
<TD width=7>· </TD>
<TD width=143><A href="http://www.kissjava.com/onestep/2005-05-09/2581115628478.html" target=_blank><FONT color=#000000>J2SDK和TOMCAT的安装及配置</FONT></A>(<FONT color=#ff6600>2680</FONT>)</TD></TR>
<TR>
<TD width=7>· </TD>
<TD width=143><A href="http://www.kissjava.com/onestep/2005-04-30/2351114826823.html" target=_blank><FONT color=#000000>struts傻瓜式学习（一天篇）</FONT></A>(<FONT color=#ff6600>2572</FONT>)</TD></TR>
<TR>
<TD width=7>· </TD>
<TD width=143><A href="http://www.kissjava.com/doc/j2ee/webservice/2005-04-30/1041114826753.html" target=_blank><FONT color=#000000>Spring&nbsp;framework&nbsp;10分钟入门</FONT></A>(<FONT color=#ff6600>2188</FONT>)</TD></TR>
<TR>
<TD width=7>· </TD>
<TD width=143><A href="http://www.kissjava.com/onestep/2005-06-07/19661117982185.html" target=_blank><FONT color=#000000>图解利用Eclipse3+Lomboz3+Tomcat开发JSP</FONT></A>(<FONT color=#ff6600>1704</FONT>)</TD></TR></TBODY></TABLE></TD>
<TD width=1 bgColor=#adadad></TD></TR></TBODY></TABLE>
<TABLE height=1 cellSpacing=0 cellPadding=0 width=160 bgColor=#adadad border=0>
<TBODY>
<TR>
<TD></TD></TR></TBODY></TABLE></TD>
<TD width=1 bgColor=#b9bebe rowSpan=13></TD></TR>
<TR>
<TD vAlign=top bgColor=#f0f2fb height=5></TD></TR>
<TR>
<TD vAlign=top background=http://www.kissjava.com/skin/bluewhite/newhard-040906_c_1.gif bgColor=#f0f2fb height=1></TD></TR>
<TR>
<TD vAlign=top bgColor=#dee2f5>
<TABLE height=25 cellSpacing=0 cellPadding=0 width=590 align=center border=0>
<TBODY>
<TR>
<TD width=90><FONT class=f21 color=#0e3e92 size=2><B>[正文]</B></FONT></TD>
<TD align=right width=480>
<P align=right><FONT color=#0e3e92 size=2></FONT></P></TD>
<TD align=middle width=20><FONT color=#0e3e92 size=2></FONT></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD vAlign=top background=http://www.kissjava.com/skin/bluewhite/newhard-040906_c_1.gif bgColor=#f0f2fb height=1><FONT color=#0e3e92 size=2></FONT></TD></TR>
<TR>
<TD vAlign=top bgColor=#f0f2fb height=10><FONT color=#0e3e92 size=2></FONT></TD></TR>
<TR>
<TD vAlign=top bgColor=#f0f2fb>
<TABLE cellSpacing=0 cellPadding=0 width=590 align=center border=0>
<TBODY>
<TR>
<TD><SPAN class=f14>
<P>　　 
<P>我最近看了不少有关Lomboz的资料，发现有不少网友都对这个eclipse插件感兴趣，但苦于入门。感觉有必要把自己学习Lomboz的心得写下来，以便后来人不至于走太多的弯路。 </P>
<H3>一.环境需求：</H3>
<DIV><STRONG>1. Lomboz的相关资源</STRONG></DIV>
<DIV>　　由于这篇文章重点是放在Lomboz上，所以有必要强调一下。lomboz是Eclipse的一个J2EE的插件，它将很多Java应用服务器、J2EE组件和Web应用开发集成到Eclipse中，可以帮助Java开发者使用Eclipse建立、测试、部署J2EE应用。</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </DIV>
<DIV>　　<FONT color=#000000><STRONG>注意 </STRONG>下载的时候需要下载两个文件，一个是Lomboz3.0.1 一个是emf-sdo-runtime-2.0.0.zip（这个程序也可以从eclipe官方网站上下载最新版本</FONT><A href="http://www.eclipse.org/emf/"><FONT color=#000000 size=2>http://www.eclipse.org/emf/</FONT></A><FONT color=#000000>）</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>　　<A href="http://tech.163.com/school"><FONT color=#0066cc size=2>教程</FONT></A>和论坛都是属于Lomboz官方网站的，虽然都是英文资料，但是对于学习Lomboz有很大的帮助。对于想真正了解Lomboz的话（当然最好是直接看源码了），英文又过得去，还是应该看看教程和论坛上的资料。</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><STRONG>2. 我的配置</STRONG></DIV>
<DIV>　　Winxp SP1，</DIV>
<DIV>　　JDK 1.4.2-04&nbsp; 可以从SUN官方网站下载</DIV>
<DIV>　　Eclipse 3.0.1&nbsp;和语言包 </DIV>
<DIV>　　Tomcat 5.0.28</DIV>
<DIV>　　Lomboz&nbsp;3.0.1</DIV>
<DIV>&nbsp;</DIV>
<DIV><STRONG>3.&nbsp;目录结构</STRONG></DIV>
<DIV>　　F:\\\\j2sdk&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; JDK目录&nbsp;</DIV>
<DIV>　　D:\\\\eclipse&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Eclipse 目录</DIV>
<DIV>　　F:\\\\java\\\\jakarta-tomcat&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Tomcat 5.0.28 目录</DIV>
<DIV>　　D:\\\\plug-in\\\\lomboz.301&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Lomboz目录（我这里是采用links方式<FONT color=#000000>安装的，</FONT></DIV>
<H4>二. 配置开发环境</H4>
<DIV>　　打开Eclipse，点击菜单“窗口”-&gt;首选项，以下都在“首选项”中配置：</DIV>
<DIV>　　1. Java-&gt;构建路径&nbsp;&nbsp;&nbsp; </DIV>
<P align=center><IMG alt="" src="http://www.kissjava.com/doc/ev_tools/tools/images/h000/h25/img200508230915010.jpg"></P>
<DIV>　　2. Lomboz&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</DIV>
<P align=center><IMG alt="" src="http://www.kissjava.com/doc/ev_tools/tools/images/h000/h25/img200508230915021.jpg"></P>
<DIV></DIV>
<DIV>　　3.Lomboz-&gt;Server Definitions-&gt;Properties&nbsp;&nbsp; </DIV>
<P align=center><IMG alt="" src="http://www.kissjava.com/doc/ev_tools/tools/images/h000/h25/img200508230915072.jpg"></P>
<DIV>　　4. 切换到主界面，点击“窗口”菜单-&gt;定制透视图&nbsp;&nbsp; </DIV>
<P align=center><IMG alt="" src="http://www.kissjava.com/doc/ev_tools/tools/images/h000/h25/img200508230915123.jpg"></P>
<DIV>　　切换到“命令”菜单&nbsp; </DIV>
<P align=center><IMG alt="" src="http://www.kissjava.com/doc/ev_tools/tools/images/h000/h25/img200508230915184.jpg"></P>
<DIV>　　5. 配置后的效果&nbsp; </DIV>
<P align=center><IMG alt="" src="http://www.kissjava.com/doc/ev_tools/tools/images/h000/h25/img200508230915235.jpg"></P>
<DIV>　　<FONT color=#ff0000>注意：</FONT></DIV>
<DIV>　　由于Tomcat 5.0.27、5.0.28版本在Lomboz中无法启动，故需要一些修改。<BR></DIV>
<DIV>　　找到“D:\\\\plug-in\\\\lomboz.301\\\\eclipse\\\\plugins\\\\com.objectlearn.jdt.j2ee_3.0.1\\\\servers”目录（我采用的是links安装方式）；如果采用的是直接把Lomboz解压到Eclipse来安装的，那么要找到“eclipse的安装目录<A href="file://plugins////com.objectlearn.jdt.j2ee_3.0.1////servers"><FONT color=#0066cc size=2>\\\\plugins\\\\com.objectlearn.jdt.j2ee_3.0.1\\\\servers</FONT></A>”目录。<BR></DIV>
<DIV>　　这个目录里面都是相关服务器的配置文件，如果有些配置文件用不到，尽管删除，避免造成视觉疲劳。</DIV>
<DIV>如，我只留下了几个文件。&nbsp;&nbsp;&nbsp; </DIV>
<P align=center><IMG alt="" src="http://www.kissjava.com/doc/ev_tools/tools/images/h000/h25/img200508230915296.jpg"></P>
<DIV></DIV>
<DIV>　　先把“tomcat50x.server”文件改名为“tomcat5028.server”（我用的是5.0.28版本），看起来方便。</DIV>
<DIV>打开这个文件，做如下修改：&nbsp; </DIV>
<P align=center><IMG alt="" src="http://www.kissjava.com/doc/ev_tools/tools/images/h000/h25/img200508230915327.jpg"></P>
<P align=center><IMG alt="" src="http://www.kissjava.com/doc/ev_tools/tools/images/h000/h25/img200508230915388.jpg"></P>
<DIV>　　最后保存即可。<BR><BR><BR>
<DIV class=post>
<H4>三. 编辑一个JSP实例</H4>
<DIV>　　1.新建一个“Lomboz J2EE Project”。&nbsp;在“项目名称”中填入“JspSample”，点击“下一步”，再点击“下一步”。&nbsp; </DIV>
<P align=center><IMG alt="" src="http://www.kissjava.com/doc/ev_tools/tools/images/h000/h25/img200508230915439.jpg"></P>
<DIV>　　2.填写Web模块&nbsp; </DIV>
<P align=center><IMG alt="" src="http://www.kissjava.com/doc/ev_tools/tools/images/h000/h25/img2005082309154810.jpg"></P>
<DIV>　　3.增加一个服务器（可以增加多个服务器，其中有一个是默认的）&nbsp;&nbsp; </DIV>
<P align=center><IMG alt="" src="http://www.kissjava.com/doc/ev_tools/tools/images/h000/h25/img2005082309154911.jpg"></P>
<DIV>　　4. 效果如下：&nbsp;&nbsp; </DIV>
<P align=center><IMG alt="" src="http://www.kissjava.com/doc/ev_tools/tools/images/h000/h25/img2005082309154912.jpg"></P>
<DIV>　　5.双击打开index.jsp，点击“Lomboz View”按钮，如下图：&nbsp;&nbsp; </DIV>
<P align=center><IMG alt="" src="http://www.kissjava.com/doc/ev_tools/tools/images/h000/h25/img2005082309155513.jpg"></P>
<DIV>　　先点击“启动服务器”按钮（或在“Apache Tomcat v5.0.28”右击，选择“Run Server”），如果一切正常，在“控制台窗口”会输出“信息：Server startup in ... ms”。</DIV>
<DIV>&nbsp;</DIV>
<DIV>　　然后切换到“Lomboz J2EE View”栏，选中“demoWeb”，点击“部署模块”按钮，可以看到输出信息，</DIV>
<DIV>大致内容是生成了一个“demoWeb.war”文件，并且部署到“F:\\\\java\\\\jakarta-tomcat\\\\webapps”（这是我的电脑上的Tomcat目录）的目录中，接着，Tomcat服务器自动解压并初始化“demoWeb.war”。</DIV>
<DIV>&nbsp;</DIV>
<DIV>　　打开浏览器，在地址栏中输入“http://127.0.0.1:8080/demoWeb/index.jsp”</DIV>
<DIV>　　OK！ 你应该可以看到以下界面：&nbsp;&nbsp; </DIV>
<P align=center><IMG alt="" src="http://www.kissjava.com/doc/ev_tools/tools/images/h000/h25/img2005082309160114.jpg"></P>
<DIV>　　也可以右击“包资源管理器”中的“demoWeb”文件夹，然后采用以下步骤，如图：&nbsp; </DIV>
<P align=center><IMG alt="" src="http://www.kissjava.com/doc/ev_tools/tools/images/h000/h25/img2005082309160615.jpg"></P>
<DIV>&nbsp;&nbsp; 6.在“index.jsp”中增加一条语句“&lt;%&nbsp;&nbsp; out.println("Use JSP!");&nbsp; %&gt;”,然后保存，点击“部署模块”，刷新浏览器，应该可以看到以下界面：</DIV>
<P align=center><IMG alt="" src="http://www.kissjava.com/doc/ev_tools/tools/images/h000/h25/img2005082309162116.jpg"></P>
<P align=center><IMG alt="" src="http://www.kissjava.com/doc/ev_tools/tools/images/h000/h25/img2005082309162717.jpg"></P>
<DIV>　　7. 再增加以下语句，保存，部署模块，刷新浏览器。</DIV>
<P align=center><IMG alt="" src="http://www.kissjava.com/doc/ev_tools/tools/images/h000/h25/img2005082309162718.jpg"></P>
<P align=center><IMG alt="" src="http://www.kissjava.com/doc/ev_tools/tools/images/h000/h25/img2005082309163219.jpg"></P>
<DIV><STRONG><FONT size=4>1. 需要的软件</FONT></STRONG></DIV>
<DIV>　　<STRONG>JSTL 1.1.1</STRONG> </DIV>
<DIV>　　主页 <A href="http://jakarta.apache.org/taglibs/doc/standard-doc/intro.html"><FONT color=#0066cc size=2>http://jakarta.apache.org/taglibs/doc/standard-doc/intro.html</FONT></A></DIV>
<DIV>　　下载 <A href="http://www.apache.org/dist/jakarta/taglibs/standard/binaries/jakarta-taglibs-standard-1.1.1.zip"><FONT color=#0066cc size=2>http://www.apache.org/dist/jakarta/taglibs/standard/binaries/jakarta-taglibs-standard-1.1.1.zip</FONT></A></DIV>
<DIV><FONT color=#0066cc size=2></FONT>&nbsp;</DIV>
<DIV><FONT color=#0066cc size=2></FONT>&nbsp;</DIV>
<DIV>　　<STRONG>XML Buddy</STRONG>&nbsp;&nbsp; </DIV>
<DIV>　　主页&nbsp;<A href="http://xmlbuddy.com/"><FONT color=#0066cc size=2>http://xmlbuddy.com</FONT></A>&nbsp;&nbsp; </DIV>
<DIV>　　下载<A href="http://xmlbuddy.com/2.0/58904908428240984589/409502405985075764578/3.0M9/xmlbuddy_2.0.10.zip"><FONT color=#0066cc size=2>http://xmlbuddy.com/2.0/58904908428240984589/409502405985075764578/3.0M9/xmlbuddy_2.0.10.zip</FONT></A></DIV>
<DIV>　　这是一个eclipse插件，可以帮助编辑xml文件（可选安装）。</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=4><STRONG>2.环境配置</STRONG></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>　　新建一个Lomboz J2EE Project，</DIV>
<DIV>　　工程名称：“JSTL Sample”；</DIV>
<DIV>　　填写Web Modules：“demoWeb2”；</DIV>
<DIV>　　添加的Servers：“Tomcat 5.0.28”，</DIV>
<DIV>　　由于我的上篇文章对eclipse新建工程介绍的比较详细，这里从简。</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>　　目录结构</DIV>
<DIV>　　F:\\\\j2sdk&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; JDK目录&nbsp; 
<DIV>　　D:\\\\eclipse&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Eclipse 目录</DIV>
<DIV>　　F:\\\\java\\\\jakarta-tomcat&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Tomcat 5.0.28 目录</DIV>
<DIV>　　D:\\\\plug-in\\\\lomboz.301&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Lomboz目录（我这里是采用links方式<FONT color=#000000>安装的，</FONT></DIV>
<DIV>　　D:\\\\java\\\\jstl&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; jakarta-taglibs-standard-1.1.1.zip的解压目录</DIV>
<DIV>　　D:\\\\eclipse\\\\workspace\\\\JSTL Sample&nbsp;&nbsp;&nbsp;&nbsp; 刚建立的JSTL Sample工程目录</DIV></DIV>
<DIV>&nbsp;&nbsp;&nbsp; <STRONG>根据安装的软件，自己作个合适的配置。</STRONG></DIV>
<DIV><STRONG></STRONG>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><STRONG><FONT size=4>3.&nbsp;加入库文件</FONT></STRONG></DIV>
<DIV>&nbsp;</DIV>
<DIV>　　找到jslt\\\\lib目录，复制其中的jstl.jar、standard.jar文件到刚建立的“JSTL Sample”工程目录中的lib目录（这里为“D:\\\\eclipse\\\\workspace\\\\JSTL Sample\\\\demoWeb2\\\\WEB-INF\\\\lib”）。</DIV>
<DIV>&nbsp;</DIV>
<DIV>　　找到jstl\\\\tld目录，复制其中的c.tld文件到“JSTL Sample”目录中的“\\\\demoWeb2\\\\WEB-INF”目录。</DIV>
<DIV>&nbsp;</DIV>
<DIV>　　刷新demoWeb2目录，展开如图，可以看到加入的三个文件已经显示出来了：</DIV>
<DIV>&nbsp;</DIV>
<P align=center><IMG alt="" src="http://www.kissjava.com/doc/ev_tools/tools/images/h000/h25/img2005082309163820.jpg"></P>
<DIV>&nbsp;</DIV>
<DIV><STRONG><FONT size=4>4.修改程序</FONT></STRONG></DIV>
<DIV>&nbsp;</DIV>
<DIV>
<TABLE style="BORDER-LEFT-COLOR: rgb(204,204,204); BORDER-BOTTOM-COLOR: rgb(204,204,204); BORDER-TOP-COLOR: rgb(204,204,204); BORDER-RIGHT-COLOR: rgb(204,204,204)" cellSpacing=0 borderColorDark=white width="90%" align=center borderColorLight=black border=1>
<TBODY>
<TR>
<TD vAlign=top width="100%" bgColor=#cdcdcd>
<P><STRONG><FONT color=#000000>注意</FONT></STRONG></P></TD></TR>
<TR>
<TD vAlign=top width="100%" bgColor=white>
<DIV><FONT color=#000000>由于Lomboz只支持JSTL1.1以上版本，EL 是在JSP 2.0 中正式纳入规范的，所以web.xml 应该使用2.4的Schema， 而不是2.3的DTD。<FONT size=2><FONT size=3>&nbsp;</FONT>&nbsp;&nbsp; </FONT></FONT></DIV></TD></TR></TBODY></TABLE><FONT style="BACKGROUND-COLOR: #c0c0c0">
<DIV style="MARGIN-BOTTOM: 0in"><FONT color=#000000></FONT>&nbsp;</DIV></FONT></DIV>
<DIV>&nbsp;&nbsp; </DIV>
<DIV>　　打开WEB-INF目录下的web.xml文件，修改如下：&nbsp; </DIV>
<DIV align=center>
<TABLE borderColor=#000000 cellSpacing=0 cellPadding=4 width="90%" align=center border=0>
<COLGROUP>
<COL width=256>
<TBODY>
<TR>
<TD style="BORDER-BOTTOM: rgb(51,51,204) thin inset" vAlign=top width="100%" bgColor=#d9eaf2 height=33>
<P>WEB-INF/web.xml</P></TD></TR>
<TR>
<TD style="BORDER-TOP-STYLE: none; BORDER-TOP-COLOR: rgb(236,233,216)" vAlign=top width="100%" bgColor=#edf2b8><PRE> <FONT size=4>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;</FONT></PRE><PRE><FONT size=4>&lt;web-app xmlns="</FONT><A href="http://java.sun.com/xml/ns/j2ee"><FONT face=Arial color=#0066cc size=4>http://java.sun.com/xml/ns/j2ee</FONT></A><FONT size=4>"<BR>&nbsp;&nbsp;&nbsp; xmlns:xsi="</FONT><A href="http://www.w3.org/2001/XMLSchema-instance"><FONT face=Arial color=#0066cc size=4>http://www.w3.org/2001/XMLSchema-instance</FONT></A><FONT size=4>"<BR>&nbsp;&nbsp;&nbsp; xsi:schemaLocation="</FONT><A href="http://java.sun.com/xml/ns/j2ee"><FONT face=Arial color=#000000 size=4>http://java.sun.com/xml/ns/j2ee</FONT></A><FONT color=#000000 size=4> web-app_2_4.xsd"<BR>&nbsp;&nbsp;&nbsp; version="2.4"&gt;</FONT></PRE><PRE><FONT size=4>&nbsp;&lt;welcome-file-list&gt;<BR>&nbsp;&nbsp;&lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;<BR>&nbsp;&lt;/welcome-file-list&gt;</FONT></PRE><PRE><FONT size=4>&nbsp;&lt;error-page&gt;<BR>&nbsp;&nbsp;&lt;error-code&gt;404&lt;/error-code&gt;<BR>&nbsp;&nbsp;&lt;location&gt;/error.jsp&lt;/location&gt;<BR>&nbsp;&lt;/error-page&gt;</FONT></PRE><PRE><FONT size=4>&lt;/web-app&gt;</FONT></PRE></TD></TR></TBODY></COL></COLGROUP></TABLE></DIV>
<DIV><FONT size=4></FONT>&nbsp;</DIV>
<DIV><FONT style="BACKGROUND-COLOR: #c0c0c0">
<TABLE style="BORDER-LEFT-COLOR: rgb(204,204,204); BORDER-BOTTOM-COLOR: rgb(204,204,204); BORDER-TOP-COLOR: rgb(204,204,204); BORDER-RIGHT-COLOR: rgb(204,204,204)" cellSpacing=0 borderColorDark=white width="90%" align=center borderColorLight=black border=1>
<TBODY>
<TR>
<TD vAlign=top width="100%" bgColor=#cdcdcd>
<P><STRONG><FONT color=#000000>注意</FONT></STRONG></P></TD></TR>
<TR>
<TD vAlign=top width="100%" bgColor=white>
<DIV><FONT color=#000000>如果你安装了XMLBuddy插件，并且是用它来打开“web.xml”文件，有可能会出现以下的错误“Cannot find the declaration of the element \\\'web-app\\\'”，<FONT size=2><FONT size=3>关闭“web.xml”文件，错误消失。它不妨碍程序的运行。&nbsp;</FONT>&nbsp;&nbsp; </FONT></FONT></DIV></TD></TR></TBODY></TABLE></FONT></DIV><FONT style="BACKGROUND-COLOR: #c0c0c0">
<DIV style="MARGIN-BOTTOM: 0in"><FONT color=#000000></FONT>&nbsp;</DIV>
<DIV style="MARGIN-BOTTOM: 0in">&nbsp;</DIV></FONT>
<DIV style="MARGIN-BOTTOM: 0in" align=center>　　下面修改index.jsp文件</DIV>
<DIV align=center>
<TABLE borderColor=#000000 cellSpacing=0 cellPadding=4 width="90%" border=0>
<COLGROUP>
<COL width=256>
<TBODY>
<TR>
<TD style="BORDER-BOTTOM: rgb(51,51,204) thin inset" vAlign=top width="100%" bgColor=#d9eaf2 height=33>
<P>demoWeb2/index.j<FONT color=#000000>sp </FONT></P></TD></TR>
<TR>
<TD style="BORDER-TOP-STYLE: none; BORDER-TOP-COLOR: rgb(236,233,216)" vAlign=top width="100%" bgColor=#edf2b8>
<DIV>&lt;<A href="mailto:%@page"><FONT color=#0066cc>%@page</FONT></A> contentType="text/html;charset=gbk" %&gt;<BR>&lt;%@ taglib uri="<A href="http://java.sun.com/jsp/jstl/core"><FONT color=#0066cc>http://java.sun.com/jsp/jstl/core</FONT></A>" prefix="c" %&gt;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&lt;html&gt;<BR>&nbsp; &lt;head&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;title&gt;Count to 10 Example (using JSTL and scriptlet)&lt;/title&gt;<BR>&nbsp; &lt;/head&gt;<BR>&nbsp; &lt;body&gt;<BR>&nbsp; <BR>&nbsp;&nbsp;&nbsp; &lt;%-- 这是利用JSTL 打印1到10 --%&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 利用JSTL 打印1到10 &lt;p&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;c:forEach var="i" begin="1" end="10" step="1"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;c:out value="${i}" /&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;br/&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;/c:forEach&gt;<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; &lt;%-- 这是利用JSP的scriptlet 打印1到10 --%&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;p&gt;&nbsp;&nbsp;&nbsp; 利用JSP的scriptlet 打印1到10&nbsp;&nbsp; &lt;p&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;%&nbsp; for(int i=1;i&lt;=10;i++)&nbsp; {%&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;%=i%&gt;&lt;br/&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;%&nbsp; } %&gt;<BR>&nbsp;&nbsp; <BR>&nbsp;&lt;/body&gt;<BR>&lt;/html&gt;</DIV></TD></TR></TBODY></COL></COLGROUP></TABLE></DIV>
<DIV align=center><FONT size=2></FONT>&nbsp;</DIV>
<DIV align=center><FONT size=2></FONT></DIV>
<DIV align=center>
<TABLE style="BORDER-LEFT-COLOR: rgb(204,204,204); BORDER-BOTTOM-COLOR: rgb(204,204,204); BORDER-TOP-COLOR: rgb(204,204,204); BORDER-RIGHT-COLOR: rgb(204,204,204)" cellSpacing=0 borderColorDark=white width="90%" borderColorLight=black border=1>
<TBODY>
<TR>
<TD vAlign=top width="100%" bgColor=#cdcdcd>
<DIV><STRONG>注意</STRONG></DIV></TD></TR>
<TR>
<TD vAlign=top width="100%" bgColor=white>
<DIV>在Lomboz中，只支持JSTL 1.1版本，所以其核心标签库的uri默认为<A href="http://java.sun.com/jsp/jstl/core"><FONT color=#0066cc>http://java.sun.com/jsp/jstl/core</FONT></A>。 </DIV>
<DIV>因为JSTL 1.1同时支持JSTL 1.0和1.1，所以假若核心标签库的uri为<A href="http://java.sun.com/jstl/core"><FONT color=#0066cc>http://java.sun.com/jstl/core</FONT></A>，则将会使用到JSTL 1.0的核心标签库，此时Lomboz将出现错误。</DIV></TD></TR></TBODY></TABLE></DIV>
<DIV align=center>&nbsp;</DIV>
<DIV><FONT size=4><STRONG></STRONG></FONT>&nbsp;</DIV>
<DIV><FONT size=4><STRONG>5.运行程序</STRONG></FONT></DIV>
<DIV><FONT size=4><STRONG>　　</STRONG>保存文件后，部署demoWeb2模块，运行服务器，然后在浏览器窗口输入地址：</FONT></DIV>
<DIV><FONT size=4>　　<A href="http://localhost:8080/demoWeb2"><FONT color=#0066cc size=2>http://localhost:8080/demoWeb2</FONT></A>&nbsp;</FONT></DIV>
<DIV><FONT size=4></FONT>&nbsp;</DIV>
<DIV><FONT size=4>　　OK! 应该可以看到如下界面：</FONT></DIV>
<P align=center><FONT size=4><IMG alt="" src="http://www.kissjava.com/doc/ev_tools/tools/images/h000/h25/img2005082309163821.jpg"></FONT></P><FONT size=4></FONT></DIV></DIV>
<P></P>
<P><BR></P></SPAN></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE><img src ="http://www.blogjava.net/tomblog/aggbug/13161.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tomblog/" target="_blank">小猫Blog</a> 2005-09-16 16:06 <a href="http://www.blogjava.net/tomblog/archive/2005/09/16/13161.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>sqlserver 2000h 和 jdbc 的融合问题</title><link>http://www.blogjava.net/tomblog/archive/2005/09/16/13160.html</link><dc:creator>小猫Blog</dc:creator><author>小猫Blog</author><pubDate>Fri, 16 Sep 2005 08:03:00 GMT</pubDate><guid>http://www.blogjava.net/tomblog/archive/2005/09/16/13160.html</guid><wfw:comment>http://www.blogjava.net/tomblog/comments/13160.html</wfw:comment><comments>http://www.blogjava.net/tomblog/archive/2005/09/16/13160.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/tomblog/comments/commentRss/13160.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tomblog/services/trackbacks/13160.html</trackback:ping><description><![CDATA[<DIV id=title><A href="http://www.matrix.org.cn/user.shtml;jsessionid=803F6B7B8E9658FDB5436CF129D83418?userid=77941"><BR>
<H2>sqlserver 2000h 和 jdbc 的融合问题</H2>
<H2><BR></A>
<SCRIPT type=text/javascript><!--
google_ad_client = "pub-4196225375348397";
google_alternate_ad_url = "http://www.matrix.org.cn/resource/google_adsense_script.html";
google_ad_width = 336;
google_ad_height = 280;
google_ad_format = "336x280_as";
google_ad_type = "text_image";
google_ad_channel ="9027725909";
google_color_border = "F6F6F4";
google_color_bg = "F6F6F4";
google_color_link = "0000CC";
google_color_url = "339999";
google_color_text = "339999";
//--></SCRIPT>

<SCRIPT src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type=text/javascript>
</SCRIPT>
<IFRAME name=google_ads_frame marginWidth=0 marginHeight=0 src="http://pagead2.googlesyndication.com/pagead/ads?client=ca-pub-4196225375348397&amp;dt=1126857758421&amp;lmt=1122647984&amp;alternate_ad_url=http%3A%2F%2Fwww.matrix.org.cn%2Fresource%2Fgoogle_adsense_script.html&amp;format=336x280_as&amp;output=html&amp;channel=9027725909&amp;url=http%3A%2F%2Fwww.matrix.org.cn%2Fresource%2Farticle%2F1535.html&amp;color_bg=F6F6F4&amp;color_text=339999&amp;color_link=0000CC&amp;color_url=339999&amp;color_border=F6F6F4&amp;ad_type=text_image&amp;cc=100&amp;u_h=768&amp;u_w=1024&amp;u_ah=740&amp;u_aw=1024&amp;u_cd=32&amp;u_tz=480&amp;u_java=true" frameBorder=0 width=336 scrolling=no height=280 allowTransparency><img height="1" width="1" border="0" src="http://pagead2.googlesyndication.com/pagead/imp.gif?event=noiframe&client=ca-pub-4196225375348397&dt=1126857758421&lmt=1122647984&alternate_ad_url=http%3A%2F%2Fwww.matrix.org.cn%2Fresource%2Fgoogle_adsense_script.html&format=336x280_as&output=html&channel=9027725909&url=http%3A%2F%2Fwww.matrix.org.cn%2Fresource%2Farticle%2F1535.html&color_bg=F6F6F4&color_text=339999&color_link=0000CC&color_url=339999&color_border=F6F6F4&ad_type=text_image&cc=100&u_h=768&u_w=1024&u_ah=740&u_aw=1024&u_cd=32&u_tz=480&u_java=true" /></IFRAME></H2></DIV>
<DIV id=divnormal>
<DIV id=articleview_summary>摘要：<BR>java自身提供了对各类主流数据库系统的支持，通过提供java.sql 库，提供了一个统一的接口，使得可以在java环境下不必对程序作大规模的修改，只要更改相应的驱动程序，即可实现对各类数据库的操作，从而提高软件的生存周期和降低软件的开发成本和维护费用，本文简要地阐述一下sql server 2000 和jdk的融合问题。 <BR><BR><BR>转载：转载请保留本信息，本文来自<A href="http://www.matrix.org.cn/resource/article/1/1535.html">http://www.matrix.org.cn/resource/article/1/1535.html</A> </DIV></DIV>
<DIV id=divarticlecontent>sql server 2000 与 jdk的融合问题！<BR><BR>sql server 2000 是当今网络编程中使用的比较多的一个数据库系统，而java则是流行的网络编程语言，在网络编程中涉及的比较多也比较重要的就是数据库问题，java自身提供了对各类主流数据库系统的支持，通过提供java.sql 库，提供了一个统一的接口，使得可以在java环境下不必对程序作大规模的修改，只要更改相应的驱动程序，即可实现对各类数据库的操作，从而提高软件的生存周期和降低软件的开发成本和维护费用，在这种情况下sql server 2000 和java 的融合问题就显得比较重要了，本文简要地阐述一下sql server 2000 和jdk的融合问题。<BR><BR><BR>系统需求：<BR>数据库：sql server 2000 sp3<BR>驱动程序：sql server driver for jdbc <BR>java版本：jdk1.2以上<BR><BR>1：我们首先使用jdbc-odbc桥来实现数据库的连接，这个相对简单<BR>首先使用sql server 企业管理其建立一个数据库test，并建立一个简单的表 first_table<BR>建立odbc数据源 ，各步骤采用默认操作即可<BR><BR>编写一个简单的测试程序，该程序主要实现数据库的连接，以及一个简单的sql操作 ,代码如下：<BR><PRE class=overflow title="pre code">/***********************************************<BR> /*<BR> /*DbTest.java<BR> /*<BR> /******************************************* */<BR> <BR> import java.sql.*;<BR> <BR> public class DbTest {<BR> &nbsp; &nbsp;<BR> &nbsp; &nbsp;Connection con;<BR> &nbsp; &nbsp;Statement&nbsp; sta;<BR> &nbsp; &nbsp;ResultSet&nbsp; rs;<BR> &nbsp; &nbsp;<BR> &nbsp; &nbsp;String driver;<BR> &nbsp; &nbsp;String url;<BR> &nbsp; &nbsp;String user;<BR> &nbsp; &nbsp;String pwd;<BR> &nbsp; &nbsp;public DbTest()<BR> &nbsp; &nbsp;{<BR> &nbsp; &nbsp;&nbsp; &nbsp; driver = "sun.jdbc.odbc.JdbcOdbcDriver";<BR> &nbsp; &nbsp;&nbsp; &nbsp; url&nbsp; &nbsp; = "jdbc:odbc:store_manager";<BR> &nbsp; &nbsp;&nbsp; &nbsp; user&nbsp; &nbsp;= "share";<BR> &nbsp; &nbsp;&nbsp; &nbsp; pwd&nbsp; &nbsp; = "share";<BR> &nbsp; &nbsp;&nbsp; &nbsp; init();<BR> &nbsp; &nbsp;}<BR> &nbsp; &nbsp;public void init()<BR> &nbsp; &nbsp;{<BR> &nbsp; &nbsp;&nbsp; &nbsp;try{<BR> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; Class.forName(driver);<BR> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; System.out.println("driver is ok");<BR> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; con = DriverManager.getConnection(url,user,pwd);<BR> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; System.out.println("conection is ok");<BR> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; sta = con.createStatement();<BR> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; rs&nbsp; = sta.executeQuery("select * from room");<BR> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; while(rs.next())<BR> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;System.out.println(rs.getInt("roomNum")); <BR> &nbsp; &nbsp;&nbsp; &nbsp;}catch(Exception e)<BR> &nbsp; &nbsp;&nbsp; &nbsp; {<BR> &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;e.printStackTrace();<BR> &nbsp; &nbsp;&nbsp; &nbsp; }<BR> &nbsp; &nbsp;}<BR> &nbsp; &nbsp;<BR> &nbsp; &nbsp;public static void main(String args&nbsp; ［］)//自己替换［］<BR> &nbsp; &nbsp;{<BR> &nbsp; &nbsp;&nbsp; &nbsp;new DbTest();<BR> &nbsp; &nbsp;}<BR> }</PRE><BR><BR>运行结果如下：<BR><BR>driver is ok<BR>conection is ok<BR>1001<BR>1002<BR>1003<BR>1004<BR>1005<BR>1006<BR>Press any key to continue...<BR><BR><BR>顺利通过测试<BR><BR><BR>2，我们这次不通过odbc桥来操作数据库，我们采用sql server driver 来实现对sqlserver数据库的操作， 这将是我们这篇文章的重点，因为jdbc-odbc桥是一种常见的操作windows系统数据库的常用方法，但它存在的缺点很多，所以现在很多开发者都侧重于使用sqlserver driver来操作，在这里我们通过一步步的调试，来加深读者对这种连接的理解<BR><BR>在通常的理解下，只要我们装了sqlserver driver for jdbc 我们便可进行数据库编程，事实则不然，首先我们看下边的代码：<BR><PRE class=overflow title="pre code">/***********************************************<BR> /*<BR> /*DbTest.java<BR> /*<BR> /******************************************* */<BR> <BR> import java.sql.*;<BR> <BR> public class DbTest {<BR> &nbsp; &nbsp;<BR> &nbsp; &nbsp;Connection con;<BR> &nbsp; &nbsp;Statement&nbsp; sta;<BR> &nbsp; &nbsp;ResultSet&nbsp; rs;<BR> &nbsp; &nbsp;<BR> &nbsp; &nbsp;String driver;<BR> &nbsp; &nbsp;String url;<BR> &nbsp; &nbsp;String user;<BR> &nbsp; &nbsp;String pwd;<BR> &nbsp; &nbsp;public DbTest()<BR> &nbsp; &nbsp;{<BR> &nbsp; &nbsp;&nbsp; &nbsp; driver = "com.microsoft.jdbc.sqlserver.SQLServerDriver";;<BR> &nbsp; &nbsp;&nbsp; &nbsp; url&nbsp; &nbsp; = "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName =StoreManager";<BR> &nbsp; &nbsp;&nbsp; &nbsp; user&nbsp; &nbsp;= "sa";<BR> &nbsp; &nbsp;&nbsp; &nbsp; pwd&nbsp; &nbsp; = "potsmart10";<BR> &nbsp; &nbsp;&nbsp; &nbsp; init();<BR> &nbsp; &nbsp;}<BR> &nbsp; &nbsp;public void init()<BR> &nbsp; &nbsp;{<BR> &nbsp; &nbsp;&nbsp; &nbsp;try{<BR> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;Class.forName(driver);<BR> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;System.out.println("driver is ok");<BR> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;con = DriverManager.getConnection(url,user,pwd);<BR> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;System.out.println("conection is ok");<BR> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; sta = con.createStatement();<BR> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; rs&nbsp; = sta.executeQuery("select * from room");<BR> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; while(rs.next())<BR> &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;System.out.println(rs.getInt("roomNum")); <BR> &nbsp; &nbsp;&nbsp; &nbsp;}catch(Exception e)<BR> &nbsp; &nbsp;&nbsp; &nbsp; {<BR> &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;e.printStackTrace();<BR> &nbsp; &nbsp;&nbsp; &nbsp; }<BR> &nbsp; &nbsp;}<BR> &nbsp; &nbsp;<BR> &nbsp; &nbsp;public static void main(String args ［］)//自己替换［］<BR> &nbsp; &nbsp;{<BR> &nbsp; &nbsp;&nbsp; &nbsp;new DbTest();<BR> &nbsp; &nbsp;}<BR> }</PRE><BR><BR>这段代码跟上变得代码是一样的，差别在于驱动，还有url,这是在使用sqlserver driver for jdbc 中遇到的困惑<BR><BR>按道理讲，上边这段代码应该没错，可首先我们来看一下，如果sqlser服务器没有升级到sp3（在使用jdbc时，如果系统是xp或者2003务必要把sqlserver 升级到sp3,往上到处都有下的），我们看看运行结果<BR><BR>driver is ok<BR>java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establis<BR>hing socket.<BR>at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source<BR>)<BR>at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)<BR>at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)<BR>at com.microsoft.jdbc.sqlserver.tds.TDSConnection.&lt;init&gt;(Unknown Source)<BR><BR>at com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open(Unknown Sou<BR>rce)<BR>at com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown S<BR>ource)<BR>at com.microsoft.jdbc.base.BaseConnection.open(Unknown Source)<BR>at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)<BR>at java.sql.DriverManager.getConnection(DriverManager.java:523)<BR>at java.sql.DriverManager.getConnection(DriverManager.java:171)<BR>at DbTest.init(DbTest.java:32)<BR>at DbTest.&lt;init&gt;(DbTest.java:25)<BR>at DbTest.main(DbTest.java:46)<BR>Press any key to continue...<BR><BR>出现上边错误的主要原因是默认的数据库服务器端口 1433没有打开，无法直接连接 。<BR><BR><BR>如果升级到sp3则这个问题可以结决，我们再来看看升级之后，程序运行的结果<BR><BR><BR>driver is ok<BR>conection is ok<BR>java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]对<BR>象名 'room' 无效。<BR>at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source<BR>)<BR>at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)<BR>at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown<BR>Source)<BR>at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown<BR>Source)<BR>at com.microsoft.jdbc.sqlserver.tds.TDSExecuteRequest.processReplyToken(<BR>Unknown Source)<BR>at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Sour<BR>ce)<BR>at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.getNextResultType<BR>(Unknown Source)<BR>at com.microsoft.jdbc.base.BaseStatement.commonTransitionToState(Unknown<BR>Source)<BR>at com.microsoft.jdbc.base.BaseStatement.postImplExecu<BR>te(Unknown Source)<BR><BR>at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)<BR>at com.microsoft.jdbc.base.BaseStatement.executeQueryInternal(Unknown So<BR>urce)<BR>at com.microsoft.jdbc.base.BaseStatement.executeQuery(Unknown Source)<BR>at DbTest.init(DbTest.java:35)<BR>at DbTest.&lt;init&gt;(DbTest.java:25)<BR>at DbTest.main(DbTest.java:46)<BR>Press any key to continue...<BR><BR>在这儿，用户已经登陆上去，但是却不能访问里边的数据表，出现这个问题的原因在于sa用户为系统用户<BR>它虽然能够登陆数据库，但是storeManager数据库里边却没有这个用户的访问权限，所以，我们现在为这个数据库重新建立一个用户<BR>share ,建立过程如下：在storeManager数据库中选重用户 ---〉新建用户 -- 〉名称选择（这一步中有两个关键点 1：身份验证选sql身份验证，默认数据库选StoreManager）-〉建立新教色share ,此时更改程序，将用户登陆名和密码修改一下，重新运行程序<BR><BR>driver is ok<BR>conection is ok<BR>1001<BR>1002<BR>1003<BR>1004<BR>1005<BR>1006<BR>Press any key to continue...<BR><BR>这次顺利通过测试<BR><BR><BR><BR>总结：sqlserve 和jdbc 的融合问题，关键涉及到sp3补丁（端口开放）还有用户问题，解决这两个问题之后，剩余的便是sqlserver 操作问题了，还有一点在远程操作的时候，要把sqlserver 组设置一下，在安全性里边亦将身份验证更改为sqlserve 验证即可<BR><BR></DIV><img src ="http://www.blogjava.net/tomblog/aggbug/13160.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tomblog/" target="_blank">小猫Blog</a> 2005-09-16 16:03 <a href="http://www.blogjava.net/tomblog/archive/2005/09/16/13160.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>